车站预复位字段修改

This commit is contained in:
joylink_zhangsai 2021-02-22 10:55:55 +08:00
parent b895017e9c
commit 71ac99cb50
3 changed files with 10 additions and 9 deletions

View File

@ -429,7 +429,7 @@ public class AtsStationService {
* 计轴预复位
*/
public void preReset(Simulation simulation, Station station) {
station.setPreResetValidDuration(60 * 1000);
station.getPreResetValidDuration().set(60 * 1000);
}
/**
@ -446,9 +446,9 @@ public class AtsStationService {
}
private void updatePreResetRemainderTime(Station station) {
int remainderTime = station.getPreResetValidDuration();
if (remainderTime > 0) {
station.setPreResetValidDuration(Math.max(0, remainderTime - SimulationConstants.ATS_LOOP_RATE));
int validDuration = station.getPreResetValidDuration().get();
if (validDuration > 0) {
station.getPreResetValidDuration().compareAndExchange(validDuration, Math.max(0, validDuration - SimulationConstants.ATS_LOOP_RATE));
}
}

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
@Getter
@ -180,7 +181,7 @@ public class Station extends MayOutOfOrderDevice {
/**
* 预复位剩余时间/ms
*/
private int preResetValidDuration;
private AtomicInteger preResetValidDuration = new AtomicInteger(0);
@Override
public void reset() {
@ -204,7 +205,7 @@ public class Station extends MayOutOfOrderDevice {
this.controller = null;
this.emergencyController = false;
this.controlApplicant = null;
this.preResetValidDuration = 0;
this.preResetValidDuration = new AtomicInteger(0);
}
public List<Stand> getStandOf(boolean right) {
@ -402,7 +403,7 @@ public class Station extends MayOutOfOrderDevice {
}
public int getPreResetValidDurationInSeconds() {
return this.preResetValidDuration / 1000;
return this.preResetValidDuration.get() / 1000;
}
public enum ControlMode {

View File

@ -145,9 +145,9 @@ public class StationStatus extends DeviceStatus {
this.controlApplicant = station.getControlApplicantId();
}
status.setControlApplicant(this.controlApplicant);
if (Objects.equals(this.preResetValidDuration, station.getPreResetValidDuration())) {
if (Objects.equals(this.preResetValidDuration, station.getPreResetValidDurationInSeconds())) {
change = true;
this.preResetValidDuration = station.getPreResetValidDuration();
this.preResetValidDuration = station.getPreResetValidDurationInSeconds();
status.setPreResetValidDuration(this.preResetValidDuration);
}
return change;