Merge branch 'test-training2' of https://git.code.tencent.com/lian-cbtc/rtss-server into test-training2-xzb1

This commit is contained in:
xzb 2022-09-14 14:32:33 +08:00
commit 4c5225e19d
14 changed files with 89 additions and 79 deletions

View File

@ -294,7 +294,7 @@ public class Training2Service {
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new SimulationException(SimulationExceptionType.System_Fault, e);
} finally {
completeStepSemaphore.release();
}
@ -338,7 +338,7 @@ public class Training2Service {
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
throw new SimulationException(SimulationExceptionType.System_Fault, e);
} finally {
completeOperationSemaphore.release();
}

View File

@ -21,7 +21,7 @@ import java.util.*;
*/
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name="Route")
@ExpConditionMaterialSrcAnno(name = "Route", deviceType = MapElement.DeviceType.ROUTE)
public class Route extends MapNamedElement {
public Route(String code, String name) {
@ -269,6 +269,7 @@ public class Route extends MapNamedElement {
this.checkConflict = false;
this.settedAspect = null;
}
/**
* 是否是组合进路
*/

View File

@ -21,7 +21,7 @@ import java.util.*;
*/
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "Section")
@ExpConditionMaterialSrcAnno(name = "Section", deviceType = MapElement.DeviceType.SECTION)
public class Section extends DelayUnlockDevice {
public Section(String code, String name) {
@ -186,7 +186,7 @@ public class Section extends DelayUnlockDevice {
/**
* 是否封锁封锁后包含区段的进路不能排列
*/
@ExpConditionMaterialAnno(name = "blockade",type = "boolean",desc = "是否封锁(封锁后,包含区段的进路不能排列)")
@ExpConditionMaterialAnno(name = "blockade", type = "boolean", desc = "是否封锁")
private boolean blockade;
/**
@ -208,25 +208,24 @@ public class Section extends DelayUnlockDevice {
/**
* 进路延续保护锁闭
*/
@ExpConditionMaterialAnno(name = "overlapLock",type = "boolean",desc = "进路延续保护锁闭")
@ExpConditionMaterialAnno(name = "overlapLock", type = "boolean", desc = "是否进路延续保护锁闭")
private boolean overlapLock;
/**
* 通信车占用
*/
@ExpConditionMaterialAnno(name = "ctOccupied",type = "boolean",desc = "通信车占用")
@ExpConditionMaterialAnno(name = "ctOccupied", type = "boolean", desc = "是否通信车占用")
private boolean ctOccupied;
/**
* 计轴占用-非通信车占用
*/
@ExpConditionMaterialAnno(name = "nctOccupied",type = "boolean",desc = "计轴占用-非通信车占用")
@ExpConditionMaterialAnno(name = "nctOccupied", type = "boolean", desc = "是否非通信车占用")
private boolean nctOccupied;
/**
* 占用列车方向
*/
@ExpConditionMaterialAnno(name = "trainRight",type = "boolean",desc = "占用列车方向")
private boolean trainRight;
/**
@ -238,13 +237,13 @@ public class Section extends DelayUnlockDevice {
/**
* 计轴是否被报失效(ARB故障)
*/
@ExpConditionMaterialAnno(name = "invalid",type = "boolean",desc = "计轴是否被报失效(ARB故障)")
@ExpConditionMaterialAnno(name = "invalid", type = "boolean", desc = "是否ARB")
private boolean invalid;
/**
* 故障锁闭
*/
@ExpConditionMaterialAnno(name = "faultLock",type = "boolean",desc = "故障锁闭")
@ExpConditionMaterialAnno(name = "faultLock", type = "boolean", desc = "是否故障锁闭")
private boolean faultLock;
/**

View File

@ -22,7 +22,7 @@ import java.util.stream.Collectors;
*/
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "Signal")
@ExpConditionMaterialSrcAnno(name = "Signal", deviceType = MapElement.DeviceType.SIGNAL)
public class Signal extends DelayUnlockDevice {
public static int GUIDE_DELAY = 15 * 1000; //大铁首区段占用的引导进路的延时关闭时长
@ -192,7 +192,6 @@ public class Signal extends DelayUnlockDevice {
/**
* 重复封锁*后期去掉*
*/
@ExpConditionMaterialAnno(name = "reblockade", type = "boolean", desc = "重复封锁")
private boolean reblockade;
/**
* 侧防锁闭侧防锁闭后不能排列此信号机为始端的任何进路
@ -212,7 +211,6 @@ public class Signal extends DelayUnlockDevice {
/**
* 是否禁止联锁自动开信号
*/
@ExpConditionMaterialAnno(name = "forbidden", type = "boolean", desc = "是否禁止联锁自动开信号")
private boolean forbidden;
/**

View File

@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "StationStand")
@ExpConditionMaterialSrcAnno(name = "StationStand", deviceType = MapElement.DeviceType.STAND)
public class Stand extends MayOutOfOrderDevice {
public Stand(String code, String name) {

View File

@ -24,7 +24,7 @@ import java.util.stream.Collectors;
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "Station")
@ExpConditionMaterialSrcAnno(name = "Station", deviceType = MapElement.DeviceType.STATION)
public class Station extends MayOutOfOrderDevice {
public Station(String code, String name) {
super(code, name, DeviceType.STATION);

View File

@ -15,7 +15,7 @@ import java.util.stream.Collectors;
*/
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "Switch")
@ExpConditionMaterialSrcAnno(name = "Switch", deviceType = MapElement.DeviceType.SWITCH)
public class Switch extends DelayUnlockDevice {
public Switch(String code, String name) {
super(code, name, DeviceType.SWITCH);
@ -104,7 +104,7 @@ public class Switch extends DelayUnlockDevice {
/**
* 道岔位置表示
*/
@ExpConditionMaterialAnno(name = "pos", type = "SwitchIndication", desc = "道岔位置表示")
@ExpConditionMaterialAnno(name = "pos", type = "SwitchIndication", desc = "道岔位置")
private SwitchIndication pos;
/**

View File

@ -11,6 +11,8 @@ import club.joylink.rtss.simulation.cbtc.data.plan.TripPlan;
import club.joylink.rtss.simulation.cbtc.data.storage.vo.StorageTrainInfo;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityTrain;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@ -30,6 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
@Slf4j
@Getter
@ExpConditionMaterialSrcAnno(name = "Train", deviceType = MapElement.DeviceType.TRAIN)
public class TrainInfo extends MapElement {
private String groupNumber;
@ -80,6 +83,7 @@ public class TrainInfo extends MapElement {
/**
* 所处区段
*/
@ExpConditionMaterialAnno(name = "section", type = "SECTION", desc = "所处位置")
private String section;
/**
@ -95,6 +99,7 @@ public class TrainInfo extends MapElement {
@Setter
private Boolean right;
@ExpConditionMaterialAnno(name = "speed", type = "float", desc = "车速")
private float speed;
private boolean doorOpen;
@ -102,11 +107,13 @@ public class TrainInfo extends MapElement {
/**
* 跟踪模式
*/
@ExpConditionMaterialAnno(name = "runLevel", type = "RunLevel", desc = "列车运行级别")
private RunLevel runLevel;
/**
* 驾驶模式
*/
@ExpConditionMaterialAnno(name = "driveMode", type = "DriveMode", desc = "驾驶模式")
private DriveMode driveMode;
/**
@ -116,6 +123,7 @@ public class TrainInfo extends MapElement {
private boolean jump;
@ExpConditionMaterialAnno(name = "hold", type = "boolean", desc = "是否扣车")
private boolean hold;
/**

View File

@ -13,8 +13,6 @@ import club.joylink.rtss.simulation.cbtc.data.support.MovementAuthority;
import club.joylink.rtss.simulation.cbtc.data.support.SectionPosition;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialAnno;
import club.joylink.rtss.simulation.cbtc.training2.ecm.anno.ExpConditionMaterialSrcAnno;
import club.joylink.rtss.vo.client.operation.DriveParamVO;
import lombok.Getter;
import lombok.Setter;
@ -29,7 +27,6 @@ import java.util.*;
@Slf4j
@Getter
@Setter
@ExpConditionMaterialSrcAnno(name = "Train")
public class VirtualRealityTrain extends VirtualRealityDevice {
// -----------列车公共属性-----------
@ -125,13 +122,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 列车运行级别
*/
@ExpConditionMaterialAnno(name = "runLevel", type = "RunLevel", desc = "列车运行级别")
private RunLevel runLevel;
/**
* 驾驶模式
*/
@ExpConditionMaterialAnno(name = "driveMode", type = "DriveMode", desc = "驾驶模式")
private DriveMode driveMode;
/**
@ -265,13 +260,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 是否紧急停车信号
*/
@ExpConditionMaterialAnno(name = "signalEB", type = "boolean", desc = "是否紧急停车(信号)")
private boolean signalEB;
/**
* 是否紧急停车电路
*/
@ExpConditionMaterialAnno(name = "circuitEB", type = "boolean", desc = "是否紧急停车(电路)")
private boolean circuitEB;
/**
@ -282,7 +275,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 下一计划是否停站
*/
@ExpConditionMaterialAnno(name = "nextParking", type = "boolean", desc = "下一计划是否停站")
private boolean nextParking;
/**
@ -293,7 +285,7 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 是否扣车
*/
@ExpConditionMaterialAnno(name = "hold", type = "boolean", desc = "是否扣车")
private boolean hold;
/**
@ -304,13 +296,11 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 是否自动折返中
*/
@ExpConditionMaterialAnno(name = "dtro", type = "boolean", desc = "是否自动折返中")
private boolean dtro;
/**
* 是否换端中
*/
@ExpConditionMaterialAnno(name = "changeEnds", type = "boolean", desc = "是否换端中")
private boolean changeEnds;
/**
@ -321,19 +311,16 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* ATO是否开启
*/
@ExpConditionMaterialAnno(name = "atoOn", type = "boolean", desc = "ATO是否开启")
private boolean atoOn;
/**
* ATP是否可用
*/
@ExpConditionMaterialAnno(name = "atpOn", type = "boolean", desc = "ATP是否可用")
private boolean atpOn;
/**
* 进路优先排列
*/
@ExpConditionMaterialAnno(name = "priorityRouteSet", type = "boolean", desc = "进路优先排列")
private boolean priorityRouteSet;
/**
@ -349,7 +336,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 门模式
*/
@ExpConditionMaterialAnno(name = "doorMode", type = "DoorMode", desc = "门模式")
private DoorMode doorMode;
/**
@ -424,7 +410,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* 运行类型
*/
@ExpConditionMaterialAnno(name = "runType", type = "RunType", desc = "运行类型")
private RunType runType;
/**
@ -461,7 +446,6 @@ public class VirtualRealityTrain extends VirtualRealityDevice {
/**
* ato可以开启
*/
@ExpConditionMaterialAnno(name = "atoCanOpen", type = "boolean", desc = "ato可以开启")
private boolean atoCanOpen;
private VirtualRealityAudio vrAudio;

View File

@ -18,13 +18,14 @@ public @interface ExpConditionMaterialAnno {
* 素材名称即设备类定义中字段的名称
*/
String name();
/**
* 素材类型即即设备类定义中字段值得类型
*/
String type();
/**
* 素材描述即即设备类定义中字段的含义
*/
String desc();
}

View File

@ -1,5 +1,7 @@
package club.joylink.rtss.simulation.cbtc.training2.ecm.anno;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -19,4 +21,6 @@ public @interface ExpConditionMaterialSrcAnno {
* 值为"null"时默认取素材源类名
*/
String name() default "null";
MapElement.DeviceType deviceType();
}

View File

@ -12,6 +12,7 @@ import org.springframework.context.annotation.ClassPathScanningCandidateComponen
import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@ -21,11 +22,13 @@ import java.util.Set;
@Component
public class ExpConditionMaterialCollector extends ClassPathScanningCandidateComponentProvider implements ApplicationContextAware {
private ApplicationContext ioc;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.ioc = applicationContext;
this.setEnvironment(this.ioc.getEnvironment());
}
private Set<BeanDefinition> doScan(String... basePackages) {
Assert.notEmpty(basePackages, "At least one base package must be specified");
//
@ -38,14 +41,17 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom
}
return beanDefinitions;
}
public List<ExpConditionMaterialSrcVo> doCollect() {
Set<BeanDefinition> bds = this.doScan("club.joylink.rtss.simulation.cbtc.data.map","club.joylink.rtss.simulation.cbtc.data.vr");
Set<BeanDefinition> bds = this.doScan("club.joylink.rtss.simulation.cbtc.data.map",
"club.joylink.rtss.simulation.cbtc.data.vr", "club.joylink.rtss.simulation.cbtc.data.vo");
List<ExpConditionMaterialSrcVo> list = new ArrayList<>(bds.size());
bds.forEach(n -> {
list.add(this.create(n.getBeanClassName()));
});
return list;
}
private ExpConditionMaterialSrcVo create(String clsName) {
Class<?> cls = this.getSrcCls(clsName);
//
@ -57,6 +63,7 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom
//
ExpConditionMaterialSrcVo src = new ExpConditionMaterialSrcVo();
src.setSrcName(srcName);
src.setDeviceType(srcAnno.deviceType());
src.setMaterials(new ArrayList<>());
//
Field[] fds = cls.getDeclaredFields();
@ -74,6 +81,7 @@ public class ExpConditionMaterialCollector extends ClassPathScanningCandidateCom
//
return src;
}
private Class<?> getSrcCls(String clsName) {
Class<?> cls = null;
try {

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.simulation.cbtc.training2.ecm.vo;
import club.joylink.rtss.simulation.cbtc.data.map.MapElement;
import lombok.Data;
import java.util.List;
@ -10,6 +11,12 @@ public class ExpConditionMaterialSrcVo {
* 设备类名称条件素材来源的名称
*/
private String srcName;
/**
* 设备类型
*/
private MapElement.DeviceType deviceType;
/**
* 条件素材列表
*/