1、d341/d331里判断如果超过30分钟没有收到d3f0/f2,则做状态和统计更新
2、SingleCalc对象里不做固定解告警判断,统一在d3f2和d341里做
This commit is contained in:
parent
3913bc1ed7
commit
b60982c4f1
@ -244,8 +244,8 @@ public class SingleLineGNSSCalcService implements GNSSDataCalcService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查b562有效数,如果过少,产生告警
|
// 检查b562有效数,如果过少,产生告警——改到d341Executor检查
|
||||||
warningService.checkB562Num(deviceId, tenantId, focusCalculator.getB562Stat());
|
//warningService.checkB562Num(deviceId, tenantId, focusCalculator.getB562Stat());
|
||||||
|
|
||||||
focusCalculator.reset();
|
focusCalculator.reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import com.imdroid.sideslope.bd.Gga;
|
|||||||
import com.imdroid.sideslope.message.D331RtcmMessage;
|
import com.imdroid.sideslope.message.D331RtcmMessage;
|
||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
import com.imdroid.sideslope.server.DeviceChannel;
|
|
||||||
import com.imdroid.sideslope.server.OnlineChannels;
|
import com.imdroid.sideslope.server.OnlineChannels;
|
||||||
import com.imdroid.sideslope.service.DataPersistService;
|
import com.imdroid.sideslope.service.DataPersistService;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
@ -45,7 +44,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("receive d331 rtcm message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
logger.debug("receive d331 rtcm message of device: "+message.getId()+", seq:"+message.getSeq()+", len:"+message.getLen());
|
||||||
}
|
}
|
||||||
|
// 推送基站数据
|
||||||
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
|
if(device1.getOpMode() == GnssDevice.OP_MODE_USE) {
|
||||||
byte[] forwardBytes = message.getSrcData();
|
byte[] forwardBytes = message.getSrcData();
|
||||||
// 要求快速转发,因此用缓存,不要每次都查数据库
|
// 要求快速转发,因此用缓存,不要每次都查数据库
|
||||||
@ -67,29 +66,21 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// trx stat
|
// 如果30分钟内收到不到d3f0和d3f2,则根据UDP最后一个报文触发状态更新和统计
|
||||||
message.setTenantId(device1.getTenantId());
|
LocalDateTime now = LocalDateTime.now();
|
||||||
LocalDateTime lastTime = device1.getLastRxTime();
|
if(device1.getLastRxTime()!=null &&
|
||||||
Device lastCycleDevice;
|
device1.getLastRxTime().isBefore(now.minusMinutes(1))){
|
||||||
if(LocalDateTime.now().isAfter(lastTime.plusMinutes(1))){
|
if(device1.getLastD3f0f2Time() == null ||
|
||||||
// new cycle
|
device1.getLastD3f0f2Time().isBefore(now.minusMinutes(30))) {
|
||||||
lastCycleDevice = new Device();
|
// new cycle
|
||||||
lastCycleDevice.setDeviceId(device1.getDeviceId());
|
Device lastCycleDevice = new Device();
|
||||||
lastCycleDevice.setTenantId(device1.getTenantId());
|
lastCycleDevice.setDeviceId(device1.getDeviceId());
|
||||||
lastCycleDevice.setD3xxbytes(device1.getD3xxbytes());
|
lastCycleDevice.setTenantId(device1.getTenantId());
|
||||||
lastCycleDevice.setD341Count(device1.getD341Count());
|
lastCycleDevice.setD3xxbytes(device1.getD3xxbytes());
|
||||||
lastCycleDevice.setLastRxTime(device1.getLastRxTime());
|
lastCycleDevice.setD3xxCount(device1.getD3xxCount());
|
||||||
lastCycleDevice.setSatelitesInUse(device1.getSatelitesInUse());
|
lastCycleDevice.setLastRxTime(device1.getLastRxTime());
|
||||||
device1.clearStat();
|
lastCycleDevice.setSatelitesInUse(device1.getSatelitesInUse());
|
||||||
} else {
|
device1.clearStat();
|
||||||
lastCycleDevice = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果控制通道没连接,则收到不到d3f0和d3f2,则根据UDP最后一个报文触发状态更新和统计
|
|
||||||
// 测站的更新和统计放在解算之后进行,因为要统计固定解浮点解等信息
|
|
||||||
if(lastCycleDevice != null){
|
|
||||||
DeviceChannel channel = OnlineChannels.INSTANCE.getConfigChannel(device1.getDeviceId());
|
|
||||||
if(channel == null || !channel.isOnline()){
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
// 通知上线
|
// 通知上线
|
||||||
try {
|
try {
|
||||||
@ -102,6 +93,7 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update trx
|
||||||
device1.updateRx(message.getHeader(),message.getLen(),message.getPacketNum());
|
device1.updateRx(message.getHeader(),message.getLen(),message.getPacketNum());
|
||||||
// update gga
|
// update gga
|
||||||
Gga gga = message.getGga();
|
Gga gga = message.getGga();
|
||||||
|
|||||||
@ -7,14 +7,14 @@ import com.imdroid.sideslope.message.D341LocationMessage;
|
|||||||
import com.imdroid.sideslope.sal.Device;
|
import com.imdroid.sideslope.sal.Device;
|
||||||
import com.imdroid.sideslope.sal.DeviceService;
|
import com.imdroid.sideslope.sal.DeviceService;
|
||||||
import com.imdroid.common.util.ThreadManager;
|
import com.imdroid.common.util.ThreadManager;
|
||||||
import com.imdroid.sideslope.server.DeviceChannel;
|
import com.imdroid.sideslope.service.DataPersistService;
|
||||||
import com.imdroid.sideslope.server.OnlineChannels;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Layton
|
* @author Layton
|
||||||
@ -31,6 +31,8 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
private DeviceService deviceService;
|
private DeviceService deviceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BeidouClient beidouClient;
|
private BeidouClient beidouClient;
|
||||||
|
@Autowired
|
||||||
|
private DataPersistService dataPersistService;
|
||||||
@Override
|
@Override
|
||||||
public Void execute(D341LocationMessage message) {
|
public Void execute(D341LocationMessage message) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
@ -40,6 +42,37 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
Device device = deviceService.findByDeviceId(message.getId());
|
Device device = deviceService.findByDeviceId(message.getId());
|
||||||
if(device == null) return null;
|
if(device == null) return null;
|
||||||
message.setTenantId(device.getTenantId());
|
message.setTenantId(device.getTenantId());
|
||||||
|
|
||||||
|
// trx cycle stat
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
if(device.getLastRxTime()!=null &&
|
||||||
|
device.getLastRxTime().isBefore(now.minusMinutes(2))){
|
||||||
|
if(device.getLastD3f0f2Time() == null ||
|
||||||
|
device.getLastD3f0f2Time().isBefore(now.minusMinutes(30))) {
|
||||||
|
// new cycle
|
||||||
|
Device lastCycleDevice = new Device();
|
||||||
|
lastCycleDevice.setDeviceId(device.getDeviceId());
|
||||||
|
lastCycleDevice.setTenantId(device.getTenantId());
|
||||||
|
lastCycleDevice.setD341bytes(device.getD341bytes());
|
||||||
|
lastCycleDevice.setD341Count(device.getD341Count());
|
||||||
|
lastCycleDevice.setFixedNum(device.getFixedNum());
|
||||||
|
lastCycleDevice.setFloatNum(device.getFloatNum());
|
||||||
|
lastCycleDevice.setLastRxTime(device.getLastRxTime());
|
||||||
|
lastCycleDevice.setSatelitesInUse(device.getSatelitesInUse());
|
||||||
|
device.clearStat();
|
||||||
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
|
// 通知上线
|
||||||
|
try {
|
||||||
|
beidouClient.onDeviceActive(device.getDeviceId(), device.getTenantId());
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
dataPersistService.updateDeviceState(lastCycleDevice);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// update trx
|
||||||
device.updateRx(message.getHeader(), message.getLen(), 1);
|
device.updateRx(message.getHeader(), message.getLen(), 1);
|
||||||
double[] pos = message.getB562_loc();
|
double[] pos = message.getB562_loc();
|
||||||
device.updateB562Quality((int) pos[3]);
|
device.updateB562Quality((int) pos[3]);
|
||||||
@ -54,20 +87,6 @@ public class D341LocationMessageExecutor implements Executor<D341LocationMessage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 收到第一个数据包,如果控制通道没连接,也通知上线
|
|
||||||
if(device.getD341Count() == 1){
|
|
||||||
DeviceChannel channel = OnlineChannels.INSTANCE.getConfigChannel(device.getDeviceId());
|
|
||||||
if(channel == null || !channel.isOnline()){
|
|
||||||
// 通知上线
|
|
||||||
try{
|
|
||||||
beidouClient.onDeviceActive(device.getDeviceId(), device.getTenantId());
|
|
||||||
}
|
|
||||||
catch (Exception e){
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ThreadManager.getFixedThreadPool().submit(() -> {
|
ThreadManager.getFixedThreadPool().submit(() -> {
|
||||||
gnssCalcService.calcSingle(message,true);
|
gnssCalcService.calcSingle(message,true);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -79,6 +79,9 @@ public class D3F2StopIndicationMessageExecutor implements Executor<D3F2StopIndic
|
|||||||
if(device.getDeviceType() == Device.DEVICE_BASE_STATION) {
|
if(device.getDeviceType() == Device.DEVICE_BASE_STATION) {
|
||||||
warningService.checkD3xxNum(device);
|
warningService.checkD3xxNum(device);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
warningService.checkB562Num(device);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -57,6 +57,7 @@ public class Device {
|
|||||||
Double iPosd;
|
Double iPosd;
|
||||||
|
|
||||||
LocalDateTime lastRxTime;
|
LocalDateTime lastRxTime;
|
||||||
|
LocalDateTime lastD3f0f2Time;
|
||||||
int lastRxHead = 0;
|
int lastRxHead = 0;
|
||||||
|
|
||||||
int fixedNum = 0;
|
int fixedNum = 0;
|
||||||
@ -67,9 +68,11 @@ public class Device {
|
|||||||
lastRxTime = LocalDateTime.now();
|
lastRxTime = LocalDateTime.now();
|
||||||
switch (head){
|
switch (head){
|
||||||
case 0xd3f0:
|
case 0xd3f0:
|
||||||
|
lastD3f0f2Time = LocalDateTime.now();
|
||||||
clearStat();
|
clearStat();
|
||||||
break;
|
break;
|
||||||
case 0xd3f2:
|
case 0xd3f2:
|
||||||
|
lastD3f0f2Time = LocalDateTime.now();
|
||||||
break;
|
break;
|
||||||
case 0xd331:
|
case 0xd331:
|
||||||
d3xxCount+=count;
|
d3xxCount+=count;
|
||||||
@ -97,7 +100,6 @@ public class Device {
|
|||||||
public void updateB562Quality(int quality){
|
public void updateB562Quality(int quality){
|
||||||
if(quality == UBXUtil.FIX_RESULT) fixedNum++;
|
if(quality == UBXUtil.FIX_RESULT) fixedNum++;
|
||||||
else if(quality == UBXUtil.FLOAT_RESULT) floatNum++;
|
else if(quality == UBXUtil.FLOAT_RESULT) floatNum++;
|
||||||
else;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearStat(){
|
public void clearStat(){
|
||||||
|
|||||||
@ -161,9 +161,14 @@ public class DataPersistServiceImpl implements DataPersistService {
|
|||||||
// 检测状态和告警
|
// 检测状态和告警
|
||||||
deviceState.setState(GnssStatus.STATE_ACTIVE);
|
deviceState.setState(GnssStatus.STATE_ACTIVE);
|
||||||
warningService.checkDeviceStatus(null, deviceState);
|
warningService.checkDeviceStatus(null, deviceState);
|
||||||
|
|
||||||
|
//
|
||||||
if(device.getDeviceType() == Device.DEVICE_BASE_STATION){
|
if(device.getDeviceType() == Device.DEVICE_BASE_STATION){
|
||||||
warningService.checkD3xxNum(device);
|
warningService.checkD3xxNum(device);
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
warningService.checkB562Num(device);
|
||||||
|
}
|
||||||
|
|
||||||
if(new_flag) deviceStateRepository.insert(deviceState);
|
if(new_flag) deviceStateRepository.insert(deviceState);
|
||||||
else deviceStateRepository.updateById(deviceState);
|
else deviceStateRepository.updateById(deviceState);
|
||||||
|
|||||||
@ -11,7 +11,9 @@ public interface WarningService {
|
|||||||
* 检查一个周期内的b562数量是否足够
|
* 检查一个周期内的b562数量是否足够
|
||||||
* 返回告警级别和告警码
|
* 返回告警级别和告警码
|
||||||
*/
|
*/
|
||||||
void checkB562Num(String deviceId,Integer tenantId, int[] numB562Stat);
|
void checkB562Num(Device device);
|
||||||
|
|
||||||
|
void checkD3xxNum(Device device);
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 检查电压、RSSI等
|
* 检查电压、RSSI等
|
||||||
@ -22,5 +24,4 @@ public interface WarningService {
|
|||||||
*/
|
*/
|
||||||
void checkTrx(GnssTrxMsg msg, GnssStatus curStatus);
|
void checkTrx(GnssTrxMsg msg, GnssStatus curStatus);
|
||||||
|
|
||||||
void checkD3xxNum(Device device);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,9 +44,8 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
* 检查一个周期内的b562数量是否足够
|
* 检查一个周期内的b562数量是否足够
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void checkB562Num(String deviceId, Integer tenantId,
|
public void checkB562Num(Device device){
|
||||||
int[] numB562Stat){
|
GnssStatus status = gnssStatusMapper.getByDeviceId(device.getDeviceId());
|
||||||
GnssStatus status = gnssStatusMapper.getByDeviceId(deviceId);
|
|
||||||
if(status == null) return;
|
if(status == null) return;
|
||||||
|
|
||||||
boolean isUpdated = false;
|
boolean isUpdated = false;
|
||||||
@ -58,11 +57,13 @@ public class WarningServiceImpl implements WarningService {
|
|||||||
// b562少
|
// b562少
|
||||||
if(check(status, WarningCfg.TYPE_LESS_B562,
|
if(check(status, WarningCfg.TYPE_LESS_B562,
|
||||||
WarningCfg.TYPE_NAME_LESS_B562,true,
|
WarningCfg.TYPE_NAME_LESS_B562,true,
|
||||||
numB562Stat[0],null,
|
device.getFixedNum(),null,
|
||||||
"固定解:"+numB562Stat[0]+",浮点解:"+numB562Stat[1]+",全零:"+numB562Stat[2])) isUpdated=true;
|
"固定解:"+device.getFixedNum()+",浮点解:"+device.getFloatNum()+",全部:"+device.getD341Count())){
|
||||||
|
isUpdated=true;
|
||||||
|
}
|
||||||
|
|
||||||
//清除连续无b562
|
//清除连续无b562
|
||||||
if(0 != numB562Stat[0]){
|
if(0 != device.getFixedNum()){
|
||||||
if ((status.getWarningcode() & WarningCfg.TYPE_NO_FIXED_RESULT) != 0) {
|
if ((status.getWarningcode() & WarningCfg.TYPE_NO_FIXED_RESULT) != 0) {
|
||||||
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
status.setWarningcode(status.getWarningcode() & ~WarningCfg.TYPE_NO_FIXED_RESULT);
|
||||||
isUpdated = true;
|
isUpdated = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user