红河财经IBP盘;实体IBP盘与虚拟IBP盘交互逻辑修改(zjd的实体IBP盘逻辑相应修改)
This commit is contained in:
parent
a951c621d2
commit
f4f3f677f9
@ -20,12 +20,17 @@ public interface IVirtualRealityIbpService {
|
||||
void pressTheButton(String group, String stationCode, String buttonCode);
|
||||
|
||||
/**
|
||||
* 更新IBP元素状态(按下和松开二合一)
|
||||
* 按下或松开
|
||||
*/
|
||||
void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp,
|
||||
VirtualRealityIbp.IbpElement element, boolean pressed);
|
||||
void pressOrRelease(Simulation simulation, VirtualRealityIbp ibp,
|
||||
VirtualRealityIbp.IbpElement element, boolean pressed);
|
||||
|
||||
void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean pressed);
|
||||
void pressOrRelease(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean pressed);
|
||||
|
||||
/**
|
||||
* 更新打开或关闭状态
|
||||
*/
|
||||
void updateOnOrOff(VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean on);
|
||||
|
||||
/**
|
||||
* 收集并发送IBP的状态数据
|
||||
|
@ -72,14 +72,14 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
private void pressTheButton(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.IbpElement element) {
|
||||
boolean change = false;
|
||||
if (VirtualRealityIbp.Type.KEY.equals(element.getType())) {
|
||||
element.setOn(!element.isOn());
|
||||
element.orderTo(!element.isOn());
|
||||
return;
|
||||
} else if (VirtualRealityIbp.Type.BUTTON.equals(element.getType())) {
|
||||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
|
||||
if (!button.isOn())
|
||||
change = true;
|
||||
button.setPressed(true);
|
||||
element.setOn(true);
|
||||
element.orderTo(true);
|
||||
}
|
||||
if (change)
|
||||
effective(simulation, ibp, element);
|
||||
@ -93,8 +93,9 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
return;
|
||||
Station station = ibp.getStation();
|
||||
MapConfig config = simulation.getRepository().getConfig();
|
||||
List<Stand> stands = chooseStands(station, element, config);
|
||||
List<Stand> stands = chooseStands(station, element.getUp(), config);
|
||||
switch (element.getMean()) {
|
||||
//------------------- 信号 -------------------
|
||||
case KC:
|
||||
stands.forEach(stand -> ciApiService.ibpHoldTrain(simulation, stand.getCode()));
|
||||
break;
|
||||
@ -103,38 +104,46 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
break;
|
||||
case JJTC:
|
||||
stands.forEach(stand -> ciApiService.standEC(simulation, stand));
|
||||
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(alarm -> alarm.setOn(true));
|
||||
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).orderToOn();
|
||||
break;
|
||||
case QXJJTC:
|
||||
stands.forEach(stand -> ciApiService.cancelStandEC(simulation, stand));
|
||||
break;
|
||||
case BJQC:
|
||||
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).forEach(ele -> ele.setOn(false));
|
||||
ibp.query(VirtualRealityIbp.Mean.ALARM, element.getUp()).orderToOff();
|
||||
break;
|
||||
case ALARM:
|
||||
case SD: //试灯在IBP盘状态收集逻辑里生效
|
||||
break;
|
||||
//------------------- 屏蔽门 -------------------
|
||||
case KM: {
|
||||
stands.forEach(stand -> ciApiService.openScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.IBP));
|
||||
break;
|
||||
}
|
||||
case PSD_SMKM: //逻辑未知
|
||||
break;
|
||||
case GM: {
|
||||
stands.forEach(stand -> ciApiService.closeScreenDoor(simulation, stand.getCode(), CiStandService.PsdCommandSource.IBP));
|
||||
break;
|
||||
}
|
||||
case XXYS: {
|
||||
List<VirtualRealityIbp.IbpElement> czLights = ibp.query(VirtualRealityIbp.Mean.CZ_LIGHT, false);
|
||||
czLights.forEach(light -> light.setOn(true));
|
||||
List<VirtualRealityIbp.IbpElement> czLights = ibp.query(VirtualRealityIbp.Mean.PSD_CZYX_LIGHT, false);
|
||||
czLights.forEach(light -> light.orderTo(true));
|
||||
break;
|
||||
}
|
||||
case SXYS: {
|
||||
List<VirtualRealityIbp.IbpElement> czLights = ibp.query(VirtualRealityIbp.Mean.CZ_LIGHT, true);
|
||||
czLights.forEach(light -> light.setOn(true));
|
||||
List<VirtualRealityIbp.IbpElement> czLights = ibp.query(VirtualRealityIbp.Mean.PSD_CZYX_LIGHT, true);
|
||||
czLights.forEach(light -> light.orderTo(true));
|
||||
break;
|
||||
}
|
||||
case HSJC: {
|
||||
case PSD_HSJC: {
|
||||
stands.forEach(stand -> stand.getPsd().getVirtualScreenDoor().setInterlockRelease(true));
|
||||
break;
|
||||
}
|
||||
case PSD_BJQC:
|
||||
ibp.query(VirtualRealityIbp.Mean.PSD_ALARM, element.getUp()).orderToOff();
|
||||
break;
|
||||
case PSD_SD:
|
||||
break;
|
||||
case AXLE_RESET: {
|
||||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
|
||||
ciApiService.axleReset(simulation, button.getSectionCode());
|
||||
@ -149,20 +158,27 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
break;
|
||||
}
|
||||
case PRERESET_Z:
|
||||
break;
|
||||
case SD:
|
||||
ibp.queryByType(VirtualRealityIbp.Type.LIGHT).forEach(light -> light.setOn(true));
|
||||
case kcLight:
|
||||
case jjtcLight:
|
||||
case ALARM:
|
||||
case PSD_ALARM:
|
||||
case gmLight:
|
||||
case kmLight:
|
||||
case PSD_CZYX_LIGHT:
|
||||
case PSD_HSJC_LIGHT:
|
||||
case PSD_SDCZ_LIGHT:
|
||||
case PSD_GZBJ_LIGHT:
|
||||
break;
|
||||
default:
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception(String.format("不正确的按钮类型[%s]", element.getMean()));
|
||||
}
|
||||
}
|
||||
|
||||
private List<Stand> chooseStands(Station station, VirtualRealityIbp.IbpElement element, MapConfig config) {
|
||||
if (element.getUp() == null) {
|
||||
private List<Stand> chooseStands(Station station, Boolean up, MapConfig config) {
|
||||
if (up == null) {
|
||||
return station.getAllNormalStands();
|
||||
}
|
||||
return station.getStandOf(config.isRight(element.getUp()));
|
||||
return station.getStandOf(config.isRight(up));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -178,7 +194,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(VirtualRealityIbp.Type.BUTTON.equals(element.getType()), "元素非按钮");
|
||||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
|
||||
if (!VirtualRealityIbp.Mean.AXLE_PRE_RESET.equals(button.getMean())) {
|
||||
button.setOn(false);
|
||||
button.orderTo(false);
|
||||
} else {
|
||||
button.setEffective(false);
|
||||
}
|
||||
@ -186,11 +202,12 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
|
||||
/**
|
||||
* 更新IBP元素状态
|
||||
*
|
||||
* @param pressed true-按下;false-松开
|
||||
*/
|
||||
@Override
|
||||
public void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp,
|
||||
VirtualRealityIbp.IbpElement element, boolean pressed) {
|
||||
public void pressOrRelease(Simulation simulation, VirtualRealityIbp ibp,
|
||||
VirtualRealityIbp.IbpElement element, boolean pressed) {
|
||||
if (pressed) {
|
||||
pressTheButton(simulation, ibp, element);
|
||||
} else {
|
||||
@ -199,7 +216,7 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateElementStatus(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean pressed) {
|
||||
public void pressOrRelease(Simulation simulation, VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean pressed) {
|
||||
List<VirtualRealityIbp.IbpElement> elements = ibp.query(mean, up);
|
||||
if (pressed) {
|
||||
elements.forEach(element -> pressTheButton(simulation, ibp, element));
|
||||
@ -208,6 +225,12 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOnOrOff(VirtualRealityIbp ibp, VirtualRealityIbp.Mean mean, Boolean up, boolean on) {
|
||||
List<VirtualRealityIbp.IbpElement> elements = ibp.query(mean, up);
|
||||
elements.forEach(element -> element.setOn(on));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectAndDispatcher(Simulation simulation) {
|
||||
SimulationDataRepository repository = simulation.getRepository();
|
||||
@ -282,26 +305,27 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
MapConfig config = repository.getConfig();
|
||||
|
||||
List<VirtualRealityIbp.SquareButton> sdList = vrIbp.queryByMean(VirtualRealityIbp.Mean.SD);
|
||||
Set<String> sdSignalCodes; //处于试灯状态的信号灯
|
||||
Set<VirtualRealityIbp.Mean> sdLightMeans; //处于试灯状态的元素的意义
|
||||
if (!CollectionUtils.isEmpty(sdList)) {
|
||||
sdSignalCodes = sdList.stream()
|
||||
sdLightMeans = sdList.stream()
|
||||
.filter(VirtualRealityIbp.SquareButton::isPressed)
|
||||
.flatMap(button -> button.getSignalCodes().stream())
|
||||
.flatMap(button -> button.getSdLightMeans().stream())
|
||||
.collect(Collectors.toSet());
|
||||
} else {
|
||||
sdSignalCodes = new HashSet<>();
|
||||
sdLightMeans = new HashSet<>();
|
||||
}
|
||||
|
||||
for (VirtualRealityIbp.IbpElement element : vrIbp.getElementList()) {
|
||||
if (sdSignalCodes.contains(element.getCode())) { //如果是处于试灯状态的元素,直接点亮
|
||||
element.setOn(true);
|
||||
for (VirtualRealityIbp.IbpElement element : vrIbp.getAllElements()) {
|
||||
if (sdLightMeans.contains(element.getMean())) { //如果是处于试灯状态的元素,直接点亮
|
||||
element.orderTo(true);
|
||||
continue;
|
||||
}
|
||||
List<Stand> stands = chooseStands(station, element, config);
|
||||
List<Stand> stands = chooseStands(station, element.getUp(), config);
|
||||
if (element.getMean() == null)
|
||||
continue;
|
||||
switch (element.getMean()) {
|
||||
case HSJC:
|
||||
case PSD_SMKM:
|
||||
case PSD_HSJC:
|
||||
case KC:
|
||||
case XXYS:
|
||||
case SXYS:
|
||||
@ -314,28 +338,37 @@ public class VirtualRealityIbpService implements IVirtualRealityIbpService {
|
||||
case AXLE_RESET:
|
||||
case PRERESET_Z:
|
||||
case ALARM:
|
||||
case CZ_LIGHT:
|
||||
case PSD_CZYX_LIGHT:
|
||||
case SD:
|
||||
case PSD_ALARM:
|
||||
case PSD_BJQC:
|
||||
break;
|
||||
case kcLight:
|
||||
element.setOn(stands.stream().anyMatch(Stand::isIbpHoldTrain));
|
||||
element.orderTo(stands.stream().anyMatch(Stand::isIbpHoldTrain));
|
||||
break;
|
||||
case jjtcLight:
|
||||
element.setOn(stands.stream().allMatch(Stand::isEmergencyClosed));
|
||||
element.orderTo(stands.stream().allMatch(Stand::isEmergencyClosed));
|
||||
break;
|
||||
case gmLight:
|
||||
element.setOn(stands.stream().allMatch(stand -> stand.getPsd().isCloseAndLock()));
|
||||
element.orderTo(stands.stream().allMatch(stand -> stand.getPsd().isCloseAndLock()));
|
||||
break;
|
||||
case kmLight:
|
||||
element.setOn(!stands.stream().allMatch(stand -> stand.getPsd().isClose()));
|
||||
element.orderTo(!stands.stream().allMatch(stand -> stand.getPsd().isClose()));
|
||||
break;
|
||||
case HSJC_LIGHT:
|
||||
element.setOn(stands.stream().anyMatch(stand -> stand.getPsd().isInterlockRelease()));
|
||||
case PSD_HSJC_LIGHT:
|
||||
element.orderTo(stands.stream().anyMatch(stand -> stand.getPsd().isInterlockRelease()));
|
||||
break;
|
||||
case AXLE_PRE_RESET:
|
||||
VirtualRealityIbp.SquareButton button = (VirtualRealityIbp.SquareButton) element;
|
||||
Section section = repository.getByCode(button.getSectionCode(), Section.class);
|
||||
element.setOn(section.isPreReset());
|
||||
element.orderTo(section.isPreReset());
|
||||
break;
|
||||
case PSD_SDCZ_LIGHT: //逻辑未知
|
||||
break;
|
||||
case PSD_GZBJ_LIGHT:
|
||||
element.orderTo(stands.stream().anyMatch(Stand::hasCheckedPsdFault));
|
||||
break;
|
||||
case PSD_SD:
|
||||
break;
|
||||
default:
|
||||
throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("未知的IBP元素类型");
|
||||
|
@ -331,6 +331,16 @@ public class Stand extends MayOutOfOrderDevice {
|
||||
this.runTimeMap.put(groupNumber, runLevelTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 有能被检测到的屏蔽门故障?
|
||||
*/
|
||||
public boolean hasCheckedPsdFault() {
|
||||
DeviceFault fault = this.getFault();
|
||||
return Fault.PSD_CANNOT_BE_CLOSED.equals(fault)
|
||||
|| Fault.PSD_CANNOT_BE_OPENED.equals(fault)
|
||||
|| Fault.NO_CLOSE_AND_LOCK.equals(fault);
|
||||
}
|
||||
|
||||
/**
|
||||
* 站台折返类型策略
|
||||
*/
|
||||
|
@ -9,7 +9,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ -18,7 +17,7 @@ public class IbpStatus {
|
||||
private Map<String, IbpElementStatus> statusMap = new HashMap<>();
|
||||
|
||||
public IbpStatus(VirtualRealityIbp vrIbp) {
|
||||
for (VirtualRealityIbp.IbpElement ibpElement : vrIbp.getElementList()) {
|
||||
for (VirtualRealityIbp.IbpElement ibpElement : vrIbp.getAllElements()) {
|
||||
statusMap.put(ibpElement.getCode(), new IbpElementStatus(ibpElement));
|
||||
}
|
||||
}
|
||||
@ -26,7 +25,7 @@ public class IbpStatus {
|
||||
public IbpStatus collectDifference(VirtualRealityIbp vrIbp) {
|
||||
IbpStatus ibpStatus = new IbpStatus();
|
||||
Map<String, IbpElementStatus> diffMap = ibpStatus.getStatusMap();
|
||||
for (VirtualRealityIbp.IbpElement ibpElement : vrIbp.getElementList()) {
|
||||
for (VirtualRealityIbp.IbpElement ibpElement : vrIbp.getAllElements()) {
|
||||
IbpElementStatus status = statusMap.get(ibpElement.getCode());
|
||||
if (status == null) {
|
||||
status = new IbpElementStatus(ibpElement);
|
||||
|
@ -8,10 +8,7 @@ import lombok.Setter;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -28,7 +25,7 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
super(code, name, DeviceType.IBP);
|
||||
if (!CollectionUtils.isEmpty(ibpData.getDrawData().getSquareButtonList())) {
|
||||
for (IbpData.SquareButtonVO vo : ibpData.getDrawData().getSquareButtonList()) {
|
||||
SquareButton button = new SquareButton(vo.getCode(), vo.getMean(), false, vo.getSectionCode(), vo.getSignalCodes(), vo.getDirection());
|
||||
SquareButton button = new SquareButton(vo.getCode(), vo.getMean(), false, vo.getSectionCode(), vo.getDirection());
|
||||
addElement(button);
|
||||
}
|
||||
}
|
||||
@ -55,8 +52,8 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
this.queryByMean(Mean.SXYS).forEach(element -> element.setOn(false));
|
||||
this.queryByMean(Mean.XXYS).forEach(element -> element.setOn(false));
|
||||
this.queryByMean(Mean.SXYS).forEach(element -> element.orderTo(false));
|
||||
this.queryByMean(Mean.XXYS).forEach(element -> element.orderTo(false));
|
||||
}
|
||||
|
||||
public void addElement(IbpElement element) {
|
||||
@ -87,19 +84,27 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public <T extends IbpElement> List<T> query(Mean mean, Boolean up) {
|
||||
public <T extends IbpElement> T query(Mean mean, Boolean up) {
|
||||
return elementMap.values().stream()
|
||||
.filter(element -> mean.equals(element.getMean()) && Objects.equals(element.getUp(), up))
|
||||
.map(element -> (T) element)
|
||||
.collect(Collectors.toList());
|
||||
.findAny().orElse(null);
|
||||
}
|
||||
|
||||
public Collection<IbpElement> getElementList() {
|
||||
public <T extends IbpElement> T get(Mean mean, Boolean up) {
|
||||
T t = query(mean, up);
|
||||
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertNotNull(t,
|
||||
String.format("[%s]的IBP盘上无[%s]元素", station.debugStr(), up, mean));
|
||||
return t;
|
||||
}
|
||||
|
||||
public Collection<IbpElement> getAllElements() {
|
||||
return this.elementMap.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许操作
|
||||
*
|
||||
* @param up 是否是上行
|
||||
* @return
|
||||
*/
|
||||
@ -109,7 +114,6 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class IbpElement {
|
||||
private String code;
|
||||
|
||||
@ -117,10 +121,24 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
|
||||
private Mean mean;
|
||||
|
||||
/** 是否开启/亮灯 */
|
||||
/**
|
||||
* 是否开启/亮灯
|
||||
*/
|
||||
private boolean on;
|
||||
|
||||
/** 是否上行 */
|
||||
/**
|
||||
* 要转为开启状态
|
||||
*/
|
||||
private boolean turnOn;
|
||||
|
||||
/**
|
||||
* 要转为关闭状态
|
||||
*/
|
||||
private boolean turnOff;
|
||||
|
||||
/**
|
||||
* 是否上行
|
||||
*/
|
||||
private Boolean up;
|
||||
|
||||
public IbpElement(String code, Type type, Mean mean, boolean on, Boolean up) {
|
||||
@ -131,18 +149,50 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
this.up = up;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下令
|
||||
*/
|
||||
public void orderTo(boolean on) {
|
||||
if (isConnectReal()) {
|
||||
if (on)
|
||||
orderToOn();
|
||||
else
|
||||
orderToOff();
|
||||
} else {
|
||||
setOn(on);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOn(boolean on) {
|
||||
this.on = on;
|
||||
if (on)
|
||||
turnOn = false;
|
||||
else
|
||||
turnOff = false;
|
||||
}
|
||||
|
||||
public void orderToOn() {
|
||||
this.turnOn = true;
|
||||
this.turnOff = false;
|
||||
}
|
||||
|
||||
public void orderToOff() {
|
||||
this.turnOn = false;
|
||||
this.turnOff = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class SquareButton extends IbpElement {
|
||||
/** 是否被按下 */
|
||||
/**
|
||||
* 是否被按下
|
||||
*/
|
||||
private boolean pressed;
|
||||
|
||||
/** 按钮被按下的时刻 */
|
||||
/**
|
||||
* 按钮被按下的时刻
|
||||
*/
|
||||
private LocalDateTime pressTime;
|
||||
|
||||
/**
|
||||
@ -151,21 +201,42 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
private String sectionCode;
|
||||
|
||||
/**
|
||||
* 试灯按钮关联的灯
|
||||
* 这些意义的元素,受试灯按钮影响
|
||||
*/
|
||||
private List<String> signalCodes;
|
||||
private Set<Mean> sdLightMeans;
|
||||
|
||||
/** 有效的(防止计轴预复位按钮多次生效) */
|
||||
/**
|
||||
* 有效的(防止计轴预复位按钮多次生效)
|
||||
*/
|
||||
private boolean effective;
|
||||
|
||||
public SquareButton(String code, Mean mean, boolean on, String sectionCode, List<String> signalCodes, Boolean up) {
|
||||
public SquareButton(String code, Mean mean, boolean on, String sectionCode, Boolean up) {
|
||||
super(code, Type.BUTTON, mean, on, up);
|
||||
this.sectionCode = sectionCode;
|
||||
this.signalCodes = signalCodes;
|
||||
if (mean != null) {
|
||||
switch (mean) {
|
||||
case SD: {
|
||||
sdLightMeans = new HashSet<>();
|
||||
sdLightMeans.add(Mean.kcLight);
|
||||
sdLightMeans.add(Mean.jjtcLight);
|
||||
break;
|
||||
}
|
||||
case PSD_SD: {
|
||||
sdLightMeans = new HashSet<>();
|
||||
sdLightMeans.add(Mean.gmLight);
|
||||
sdLightMeans.add(Mean.kmLight);
|
||||
sdLightMeans.add(Mean.PSD_CZYX_LIGHT);
|
||||
sdLightMeans.add(Mean.PSD_HSJC_LIGHT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 元素类型 */
|
||||
/**
|
||||
* 元素类型
|
||||
*/
|
||||
public enum Type {
|
||||
LIGHT,
|
||||
BUTTON,
|
||||
@ -173,7 +244,9 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
ALARM,
|
||||
}
|
||||
|
||||
/** 元素意义 */
|
||||
/**
|
||||
* 元素意义
|
||||
*/
|
||||
public enum Mean {
|
||||
//------------------ 信号 ------------------
|
||||
/**
|
||||
@ -203,15 +276,17 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
|
||||
kcLight,
|
||||
jjtcLight,
|
||||
gmLight,
|
||||
kmLight,
|
||||
|
||||
SD,
|
||||
//------------------ 屏蔽门 ------------------
|
||||
/**
|
||||
* 下行屏蔽门开门
|
||||
* 开门
|
||||
*/
|
||||
KM,
|
||||
/**
|
||||
* 首末开门
|
||||
*/
|
||||
PSD_SMKM,
|
||||
GM,
|
||||
/**
|
||||
* 下行钥匙
|
||||
@ -221,19 +296,33 @@ public class VirtualRealityIbp extends VirtualRealityDevice {
|
||||
/**
|
||||
* 互锁解除
|
||||
*/
|
||||
HSJC,
|
||||
PSD_HSJC,
|
||||
/**
|
||||
* 屏蔽门的蜂鸣器
|
||||
* 屏蔽门板块的蜂鸣器
|
||||
*/
|
||||
PSD_ALARM,
|
||||
/**
|
||||
* 屏蔽门板块的报警切除
|
||||
*/
|
||||
PSD_BJQC,
|
||||
gmLight,
|
||||
kmLight,
|
||||
/**
|
||||
* 操作允许灯
|
||||
*/
|
||||
CZ_LIGHT,
|
||||
PSD_CZYX_LIGHT,
|
||||
/**
|
||||
* 互锁解除灯
|
||||
*/
|
||||
HSJC_LIGHT,
|
||||
PSD_HSJC_LIGHT,
|
||||
/**
|
||||
* 手动操作灯
|
||||
*/
|
||||
PSD_SDCZ_LIGHT,
|
||||
/**
|
||||
* 故障报警灯
|
||||
*/
|
||||
PSD_GZBJ_LIGHT,
|
||||
/**
|
||||
* 屏蔽门试灯
|
||||
*/
|
||||
|
@ -3,17 +3,24 @@ package club.joylink.rtss.simulation.cbtc.device.real.modbustcp.hhcj;
|
||||
import club.joylink.rtss.services.IVirtualRealityIbpService;
|
||||
import club.joylink.rtss.simulation.cbtc.Simulation;
|
||||
import club.joylink.rtss.simulation.cbtc.data.vr.VirtualRealityIbp;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.PlcGatewayService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.RealDeviceService;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.PlcGateway;
|
||||
import club.joylink.rtss.simulation.cbtc.device.real.modbustcp.device.RealDeviceConfig;
|
||||
import club.joylink.rtss.vo.client.project.hhcj.HhcjIbpConfigVO;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.Channel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class HhcjIbpServiceImpl implements RealDeviceService {
|
||||
@Autowired
|
||||
private IVirtualRealityIbpService iVirtualRealityIbpService;
|
||||
@Autowired
|
||||
private PlcGatewayService plcGatewayService;
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RealDeviceConfig deviceConfig) {
|
||||
@ -27,6 +34,9 @@ public class HhcjIbpServiceImpl implements RealDeviceService {
|
||||
|
||||
@Override
|
||||
public void handle(Simulation simulation, RealDeviceConfig deviceConfig, ByteBuf byteBuf) {
|
||||
PlcGateway plcGateway = simulation.queryPlcGatewayDevice();
|
||||
if (plcGateway == null)
|
||||
return;
|
||||
HhcjIbpConfig config = (HhcjIbpConfig) deviceConfig;
|
||||
VirtualRealityIbp vrIbp = (VirtualRealityIbp) config.getMapElement();
|
||||
if (vrIbp == null)
|
||||
@ -39,20 +49,158 @@ public class HhcjIbpServiceImpl implements RealDeviceService {
|
||||
boolean r_xx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_xx_gm());
|
||||
boolean r_xx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_xx_hsjc());
|
||||
boolean r_xy = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_xy());
|
||||
boolean r_dcs = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_dcs());
|
||||
boolean r_psd_sd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_psd_sd());
|
||||
boolean r_sx_cz = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_cz());
|
||||
boolean r_sx_smkm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_smkm());
|
||||
boolean r_sx_km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_km());
|
||||
boolean r_sx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_gm());
|
||||
boolean r_sx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_hsjc());
|
||||
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.XXYS, false, r_xx_cz);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.KM, false, r_xx_km);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.GM, false, r_xx_gm);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.HSJC, false, r_xx_hsjc);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.SXYS, true, r_sx_cz);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.KM, true, r_sx_km);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.GM, true, r_sx_gm);
|
||||
iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, VirtualRealityIbp.Mean.HSJC, true, r_sx_hsjc);
|
||||
boolean w_xx_czyx = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_czyx());
|
||||
boolean w_xx_smkm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_smkm());
|
||||
boolean w_xx_km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_km());
|
||||
boolean w_xx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_gm());
|
||||
boolean w_xx_gbsj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_gbsj());
|
||||
boolean w_xx_dk = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_dk());
|
||||
boolean w_xx_sdcz = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_sdcz());
|
||||
boolean w_xx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_hsjc());
|
||||
boolean w_gzbj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_gzbj());
|
||||
boolean w_psd_fmq = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_psd_fmq());
|
||||
boolean w_sx_czyx = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_czyx());
|
||||
boolean w_sx_smkm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_smkm());
|
||||
boolean w_sx_km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_km());
|
||||
boolean w_sx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_gm());
|
||||
boolean w_sx_gbsj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_gbsj());
|
||||
boolean w_sx_dk = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_dk());
|
||||
boolean w_sx_sdcz = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_sdcz());
|
||||
boolean w_sx_hsjc = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_hsjc());
|
||||
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_CZYX_LIGHT, false, w_xx_czyx);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_SMKM, false, w_xx_smkm);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.KM, false, w_xx_km);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.GM, false, w_xx_gm);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.gmLight, false, w_xx_gbsj);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.kmLight, false, w_xx_dk);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_SDCZ_LIGHT, false, w_xx_sdcz);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_HSJC_LIGHT, false, w_xx_hsjc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_GZBJ_LIGHT, null, w_gzbj);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_ALARM, null, w_psd_fmq);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_CZYX_LIGHT, true, w_sx_czyx);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_SMKM, true, w_sx_smkm);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.KM, true, w_sx_km);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.GM, true, w_sx_gm);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.gmLight, true, w_sx_gbsj);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.kmLight, true, w_sx_dk);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_SDCZ_LIGHT, true, w_sx_sdcz);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.PSD_HSJC_LIGHT, true, w_sx_hsjc);
|
||||
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.XXYS, false, r_xx_cz);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.KM, false, r_xx_km);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.GM, false, r_xx_gm);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.PSD_HSJC, false, r_xx_hsjc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.PSD_BJQC, null, r_xy);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.PSD_SD, null, r_psd_sd);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.SXYS, true, r_sx_cz);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.KM, true, r_sx_km);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.GM, true, r_sx_gm);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.PSD_HSJC, true, r_sx_hsjc);
|
||||
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
for (VirtualRealityIbp.IbpElement element : vrIbp.getAllElements()) {
|
||||
Boolean on = null;
|
||||
if (element.isTurnOn()) {
|
||||
on = true;
|
||||
} else if (element.isTurnOff()) {
|
||||
on = false;
|
||||
}
|
||||
boolean currentIsOn = false;
|
||||
Integer addr = null;
|
||||
switch (element.getMean()) {
|
||||
case KM:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_km();
|
||||
currentIsOn = w_sx_km;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_km();
|
||||
currentIsOn = w_xx_km;
|
||||
}
|
||||
break;
|
||||
case PSD_SMKM:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_smkm();
|
||||
currentIsOn = w_sx_smkm;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_smkm();
|
||||
currentIsOn = w_xx_smkm;
|
||||
}
|
||||
break;
|
||||
case GM:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_gm();
|
||||
currentIsOn = w_sx_gm;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_gm();
|
||||
currentIsOn = w_xx_gm;
|
||||
}
|
||||
break;
|
||||
case PSD_ALARM:
|
||||
addr = configVO.getW_psd_fmq();
|
||||
currentIsOn = w_psd_fmq;
|
||||
break;
|
||||
case gmLight:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_gbsj();
|
||||
currentIsOn = w_sx_gbsj;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_gbsj();
|
||||
currentIsOn = w_xx_gbsj;
|
||||
}
|
||||
break;
|
||||
case kmLight:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_dk();
|
||||
currentIsOn = w_sx_dk;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_dk();
|
||||
currentIsOn = w_xx_dk;
|
||||
}
|
||||
break;
|
||||
case PSD_CZYX_LIGHT:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_czyx();
|
||||
currentIsOn = w_sx_czyx;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_czyx();
|
||||
currentIsOn = w_xx_czyx;
|
||||
}
|
||||
break;
|
||||
case PSD_HSJC_LIGHT:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_hsjc();
|
||||
currentIsOn = w_sx_hsjc;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_hsjc();
|
||||
currentIsOn = w_xx_hsjc;
|
||||
}
|
||||
break;
|
||||
case PSD_SDCZ_LIGHT:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_sdcz();
|
||||
currentIsOn = w_sx_sdcz;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_sdcz();
|
||||
currentIsOn = w_xx_sdcz;
|
||||
}
|
||||
break;
|
||||
case PSD_GZBJ_LIGHT:
|
||||
addr = configVO.getW_gzbj();
|
||||
currentIsOn = w_gzbj;
|
||||
break;
|
||||
}
|
||||
if (addr != null && on != null) {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, addr, currentIsOn, on, channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@ -72,60 +72,77 @@ public class ZjdIbpServiceImpl implements RealDeviceService {
|
||||
boolean r_sd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sd());
|
||||
boolean r_qdbj = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_qdbj());
|
||||
boolean w_fmq = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_fmq());
|
||||
boolean w_sx_jjtcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_jjtcd());
|
||||
boolean w_xx_jjtcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_jjtcd());
|
||||
boolean w_sx_kcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_kcd());
|
||||
boolean w_xx_kcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_xx_kcd());
|
||||
boolean w_sx_jjtcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_jjtcd());
|
||||
boolean w_sx_kcd = RealDeviceConfig.getBitOf(deviceStatus, configVO.getW_sx_kcd());
|
||||
boolean r_sx_czyx = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_czyx());
|
||||
boolean r_sx_km = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_km());
|
||||
boolean r_sx_gm = RealDeviceConfig.getBitOf(deviceStatus, configVO.getR_sx_gm());
|
||||
int baseAddr = plcGateway.getConfig().getAddr() + configVO.getAddr();
|
||||
Channel channel = plcGateway.getChannel();
|
||||
//查找真实设备和vr设备
|
||||
/*------------------------- 输入 -------------------------*/
|
||||
//下行紧急停车
|
||||
List<VirtualRealityIbp.IbpElement> jjtc = vrIbp.query(VirtualRealityIbp.Mean.JJTC, false);
|
||||
jjtc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_jjtc));
|
||||
//下行取消紧停
|
||||
List<VirtualRealityIbp.IbpElement> qxjt = vrIbp.query(VirtualRealityIbp.Mean.QXJJTC, false);
|
||||
qxjt.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_qxjt));
|
||||
//下行扣车
|
||||
List<VirtualRealityIbp.IbpElement> kc = vrIbp.query(VirtualRealityIbp.Mean.KC, false);
|
||||
kc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_kc));
|
||||
//下行取消扣车
|
||||
List<VirtualRealityIbp.IbpElement> qxkc = vrIbp.query(VirtualRealityIbp.Mean.ZZKC, false);
|
||||
qxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_xx_qxkc));
|
||||
//上行紧急停车
|
||||
List<VirtualRealityIbp.IbpElement> sxjjtc = vrIbp.query(VirtualRealityIbp.Mean.JJTC, true);
|
||||
sxjjtc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_jjtc));
|
||||
//上行取消紧停
|
||||
List<VirtualRealityIbp.IbpElement> sxqxjt = vrIbp.query(VirtualRealityIbp.Mean.QXJJTC, true);
|
||||
sxqxjt.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_qxjt));
|
||||
//上行扣车
|
||||
List<VirtualRealityIbp.IbpElement> sxkc = vrIbp.query(VirtualRealityIbp.Mean.KC, true);
|
||||
sxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_kc));
|
||||
//上行取消扣车
|
||||
List<VirtualRealityIbp.IbpElement> sxqxkc = vrIbp.query(VirtualRealityIbp.Mean.ZZKC, true);
|
||||
sxqxkc.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sx_qxkc));
|
||||
//试灯
|
||||
List<VirtualRealityIbp.IbpElement> sd = vrIbp.queryByMean(VirtualRealityIbp.Mean.SD);
|
||||
sd.forEach(element -> iVirtualRealityIbpService.updateElementStatus(simulation, vrIbp, element, r_sd));
|
||||
//下行允许禁止钥匙
|
||||
List<VirtualRealityIbp.IbpElement> ibpElements = vrIbp.queryByMean(VirtualRealityIbp.Mean.XXYS);
|
||||
ibpElements.forEach(ibpElement -> ibpElement.setOn(r_sx_czyx));
|
||||
// 灯
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.jjtcLight, false, w_xx_kcd);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.kcLight, false, w_xx_kcd);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.jjtcLight, true, w_sx_kcd);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.kcLight, true, w_sx_kcd);
|
||||
// 按钮灯
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.JJTC, false, r_xx_jjtc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.QXJJTC, false, r_xx_qxjt);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.KC, false, r_xx_kc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.ZZKC, false, r_xx_qxkc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.JJTC, true, r_sx_jjtc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.QXJJTC, true, r_sx_qxjt);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.KC, true, r_sx_kc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.ZZKC, true, r_sx_qxkc);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.XXYS, false, r_sx_czyx);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.KM, true, r_sx_km);
|
||||
iVirtualRealityIbpService.updateOnOrOff(vrIbp, VirtualRealityIbp.Mean.GM, true, r_sx_gm);
|
||||
// 按钮
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.JJTC, false, r_xx_jjtc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.QXJJTC, false, r_xx_qxjt);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.KC, false, r_xx_kc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.ZZKC, false, r_xx_qxkc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.JJTC, true, r_sx_jjtc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.QXJJTC, true, r_sx_qxjt);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.KC, true, r_sx_kc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.ZZKC, true, r_sx_qxkc);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.ZZKC, null, r_sd);
|
||||
iVirtualRealityIbpService.pressOrRelease(simulation, vrIbp, VirtualRealityIbp.Mean.XXYS, false, r_sx_czyx);
|
||||
/*------------------------- 输出 -------------------------*/
|
||||
boolean xxkcd = vrIbp.query(VirtualRealityIbp.Mean.kcLight, false).stream()
|
||||
.allMatch(VirtualRealityIbp.IbpElement::isOn);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_kcd(), w_xx_kcd, xxkcd, channel);
|
||||
boolean sxkcd = vrIbp.query(VirtualRealityIbp.Mean.kcLight, true).stream()
|
||||
.allMatch(VirtualRealityIbp.IbpElement::isOn);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_kcd(), w_sx_kcd, sxkcd, channel);
|
||||
boolean xxjjtcd = vrIbp.query(VirtualRealityIbp.Mean.jjtcLight, false).stream()
|
||||
.allMatch(VirtualRealityIbp.IbpElement::isOn);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_xx_jjtcd(), w_xx_jjtcd, xxjjtcd, channel);
|
||||
boolean sxjjtcd = vrIbp.query(VirtualRealityIbp.Mean.jjtcLight, true).stream()
|
||||
.allMatch(VirtualRealityIbp.IbpElement::isOn);
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, configVO.getW_sx_jjtcd(), w_sx_jjtcd, sxjjtcd, channel);
|
||||
for (VirtualRealityIbp.IbpElement element : vrIbp.getAllElements()) {
|
||||
Integer addr = null;
|
||||
boolean currentIsOn = false;
|
||||
Boolean turnOn = null;
|
||||
if (element.isTurnOn()) {
|
||||
turnOn = true;
|
||||
} else if (element.isTurnOff()) {
|
||||
turnOn = false;
|
||||
}
|
||||
switch (element.getMean()) {
|
||||
case kcLight:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_kcd();
|
||||
currentIsOn = w_sx_kcd;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_kcd();
|
||||
currentIsOn = w_xx_kcd;
|
||||
}
|
||||
break;
|
||||
case jjtcLight:
|
||||
if (Objects.equals(true, element.getUp())) {
|
||||
addr = configVO.getW_sx_jjtcd();
|
||||
currentIsOn = w_sx_jjtcd;
|
||||
} else if (Objects.equals(false, element.getUp())) {
|
||||
addr = configVO.getW_xx_jjtcd();
|
||||
currentIsOn = w_xx_jjtcd;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (addr != null && turnOn != null) {
|
||||
plcGatewayService.checkEqualAndWriteSingleCoil(baseAddr, addr, currentIsOn, turnOn, channel);
|
||||
}
|
||||
}
|
||||
//ISCS状态
|
||||
SimulationIscsDataRepository iscsRepository = simulation.getIscsRepository();
|
||||
String iscsCode = configVO.getIscsCode();
|
||||
|
@ -36,9 +36,9 @@ public class HhcjIbpConfigVO extends RealConfigVO {
|
||||
private Integer r_xy = 15;
|
||||
|
||||
/**
|
||||
* 灯测试
|
||||
* 屏蔽门板块试灯
|
||||
*/
|
||||
private Integer r_dcs = 16;
|
||||
private Integer r_psd_sd = 16;
|
||||
|
||||
/**
|
||||
* 上行操作开关
|
||||
@ -65,6 +65,96 @@ public class HhcjIbpConfigVO extends RealConfigVO {
|
||||
*/
|
||||
private Integer r_sx_hsjc = 21;
|
||||
|
||||
/**
|
||||
* 下行IBP/PSL操作允许灯
|
||||
*/
|
||||
private Integer w_xx_czyx = 41;
|
||||
|
||||
/**
|
||||
* 下行首末开门按钮灯
|
||||
*/
|
||||
private Integer w_xx_smkm = 42;
|
||||
|
||||
/**
|
||||
* 下行开门按钮灯
|
||||
*/
|
||||
private Integer w_xx_km = 43;
|
||||
|
||||
/**
|
||||
* 下行关门按钮灯
|
||||
*/
|
||||
private Integer w_xx_gm = 44;
|
||||
|
||||
/**
|
||||
* 下行所有门关闭且锁紧灯
|
||||
*/
|
||||
private Integer w_xx_gbsj = 45;
|
||||
|
||||
/**
|
||||
* 下行所有门打开灯
|
||||
*/
|
||||
private Integer w_xx_dk = 46;
|
||||
|
||||
/**
|
||||
* 下行手动操作灯
|
||||
*/
|
||||
private Integer w_xx_sdcz = 47;
|
||||
|
||||
/**
|
||||
* 下行互锁解除灯
|
||||
*/
|
||||
private Integer w_xx_hsjc = 48;
|
||||
|
||||
/**
|
||||
* 故障报警灯
|
||||
*/
|
||||
private Integer w_gzbj = 49;
|
||||
|
||||
/**
|
||||
* 屏蔽门蜂鸣器
|
||||
*/
|
||||
private Integer w_psd_fmq = 50;
|
||||
|
||||
/**
|
||||
* 上行操作允许灯
|
||||
*/
|
||||
private Integer w_sx_czyx = 51;
|
||||
|
||||
/**
|
||||
* 上行首末开门按钮灯
|
||||
*/
|
||||
private Integer w_sx_smkm = 52;
|
||||
|
||||
/**
|
||||
* 上行开门按钮灯
|
||||
*/
|
||||
private Integer w_sx_km = 53;
|
||||
|
||||
/**
|
||||
* 上行关门按钮灯
|
||||
*/
|
||||
private Integer w_sx_gm = 54;
|
||||
|
||||
/**
|
||||
* 上行所有门关闭锁紧灯
|
||||
*/
|
||||
private Integer w_sx_gbsj = 55;
|
||||
|
||||
/**
|
||||
* 上行所有门打开灯
|
||||
*/
|
||||
private Integer w_sx_dk = 56;
|
||||
|
||||
/**
|
||||
* 上行手动操作灯
|
||||
*/
|
||||
private Integer w_sx_sdcz = 57;
|
||||
|
||||
/**
|
||||
* 上行互锁解除灯
|
||||
*/
|
||||
private Integer w_sx_hsjc = 58;
|
||||
|
||||
public HhcjIbpConfigVO() {
|
||||
super(0, 304);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user