补传数据后,更新补传最后时间的后一个平滑周期内的Rb562值
This commit is contained in:
parent
7abf19650e
commit
58d8355d6f
@ -31,7 +31,13 @@ public class MultiLineGNSSCalcService {
|
|||||||
if(msgTime!=null) logger.info("proc D342: "+msgTime+" D341 num: "+d341Count);
|
if(msgTime!=null) logger.info("proc D342: "+msgTime+" D341 num: "+d341Count);
|
||||||
|
|
||||||
if(lastDate != null){
|
if(lastDate != null){
|
||||||
if(d341Count == 0 || (msgTime!=null && msgTime.isAfter(lastDate.plusMinutes(1)))){
|
if(d341Count == 0){
|
||||||
|
// 计算上轮结果
|
||||||
|
calcService.calSingleDone(deviceId, d342Message.getTenantId(),lastDate);
|
||||||
|
// 重算最近的
|
||||||
|
dataPersistService.updateRb562(deviceId,lastDate);
|
||||||
|
}
|
||||||
|
else if(msgTime!=null && msgTime.isAfter(lastDate.plusMinutes(1))){
|
||||||
// 计算上轮结果
|
// 计算上轮结果
|
||||||
calcService.calSingleDone(deviceId, d342Message.getTenantId(),lastDate);
|
calcService.calSingleDone(deviceId, d342Message.getTenantId(),lastDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,15 @@ package com.imdroid.sideslope.service;
|
|||||||
import com.imdroid.secapi.dto.GnssCalcData;
|
import com.imdroid.secapi.dto.GnssCalcData;
|
||||||
import com.imdroid.sideslope.message.D341LocationMessage;
|
import com.imdroid.sideslope.message.D341LocationMessage;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Layton
|
* @author Layton
|
||||||
* @date 2023/2/4 20:18
|
* @date 2023/2/4 20:18
|
||||||
*/
|
*/
|
||||||
public interface GNSSDeviceLocationRecordService {
|
public interface GNSSDeviceLocationRecordService {
|
||||||
|
|
||||||
void save(GnssCalcData locationRecord, boolean isExceed) throws Exception;
|
void save(GnssCalcData locationRecord, boolean isExceed) throws Exception;
|
||||||
void saveRawData(D341LocationMessage message);
|
void saveRawData(D341LocationMessage message);
|
||||||
|
void updateRb562(String deviceId, LocalDateTime afterTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,13 +36,8 @@ public class GNSSDeviceLocationRecordServiceImpl implements GNSSDeviceLocationRe
|
|||||||
@Autowired
|
@Autowired
|
||||||
private GnssGroupCalcMapper groupCalcMapper;
|
private GnssGroupCalcMapper groupCalcMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
//private RabbitTemplate rabbitTemplate;
|
|
||||||
ThirdPartyClient thirdPartyClient;
|
|
||||||
|
|
||||||
public static final int FILTER_SHORT_CYCLE_HOUR = 4;
|
public static final int FILTER_SHORT_CYCLE_HOUR = 4;
|
||||||
public static final int FILTER_LONG_CYCLE_HOUR = 25;
|
public static final int FILTER_LONG_CYCLE_HOUR = 25;
|
||||||
static final int FILTER_MAX_RECORD_NUM = 50;
|
|
||||||
static final int FILTER_MIN_RECORD_NUM = 10;
|
static final int FILTER_MIN_RECORD_NUM = 10;
|
||||||
static final double XY_THRESHOLD = 30; //水平异常点30mm
|
static final double XY_THRESHOLD = 30; //水平异常点30mm
|
||||||
static final double Z_THRESHOLD = 30; //高程异常点30mm
|
static final double Z_THRESHOLD = 30; //高程异常点30mm
|
||||||
@ -73,7 +68,20 @@ public class GNSSDeviceLocationRecordServiceImpl implements GNSSDeviceLocationRe
|
|||||||
locationRecord.setEnabled(true);
|
locationRecord.setEnabled(true);
|
||||||
|
|
||||||
// 获取平滑参数
|
// 获取平滑参数
|
||||||
GnssGroupCalc calcParam = groupCalcMapper.selectById(gnssDevice.getCalc_group_id());
|
refreshCalcParams(gnssDevice.getCalc_group_id());
|
||||||
|
|
||||||
|
// 平滑处理
|
||||||
|
int filterCycle = shortCycleHour;
|
||||||
|
if(enableAutoFilter) {
|
||||||
|
filterCycle = calcFilterCycle(locationRecord.getDeviceid(), isExceed);
|
||||||
|
}
|
||||||
|
calcFilterLocation(locationRecord, filterCycle);
|
||||||
|
|
||||||
|
repository.insert(locationRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
void refreshCalcParams(int calcGroupId){
|
||||||
|
GnssGroupCalc calcParam = groupCalcMapper.selectById(calcGroupId);
|
||||||
if(calcParam != null){
|
if(calcParam != null){
|
||||||
if(calcParam.getXy_threshold()!=null){
|
if(calcParam.getXy_threshold()!=null){
|
||||||
xyThreshold = calcParam.getXy_threshold();
|
xyThreshold = calcParam.getXy_threshold();
|
||||||
@ -98,27 +106,12 @@ public class GNSSDeviceLocationRecordServiceImpl implements GNSSDeviceLocationRe
|
|||||||
zThreshold = Z_THRESHOLD; //高程异常点50mm
|
zThreshold = Z_THRESHOLD; //高程异常点50mm
|
||||||
longCycleHour = FILTER_LONG_CYCLE_HOUR;
|
longCycleHour = FILTER_LONG_CYCLE_HOUR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 平滑处理
|
|
||||||
int filterCycle = shortCycleHour;
|
|
||||||
if(enableAutoFilter) {
|
|
||||||
filterCycle = calcFilterCycle(locationRecord.getDeviceid(), isExceed);
|
|
||||||
}
|
|
||||||
double[] avgEND = calcFilterLocation(locationRecord, filterCycle);
|
|
||||||
if(avgEND!=null) {
|
|
||||||
locationRecord.setRb562e(NumberUtils.scaleTwo(avgEND[0]));
|
|
||||||
locationRecord.setRb562n(NumberUtils.scaleTwo(avgEND[1]));
|
|
||||||
locationRecord.setRb562d(NumberUtils.scaleTwo(avgEND[2]));
|
|
||||||
}
|
|
||||||
|
|
||||||
repository.insert(locationRecord);
|
|
||||||
if(avgEND!=null) thirdPartyClient.send(locationRecord);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算东北天的最近融合数据的加权平均, 刘畅20230725 copy 自 avgEND; id>20, 滤波参数6h 或 25h
|
* 计算东北天的最近融合数据的加权平均, 刘畅20230725 copy 自 avgEND; id>20, 滤波参数6h 或 25h
|
||||||
*/
|
*/
|
||||||
public double[] calcFilterLocation(GnssCalcData newRecord, int filterCycleHour){
|
public boolean calcFilterLocation(GnssCalcData newRecord, int filterCycleHour){
|
||||||
String deviceId = newRecord.getDeviceid();
|
String deviceId = newRecord.getDeviceid();
|
||||||
// 选取[newRecordTime-filterCycleHour, newRcordTime]之间的记录做平滑
|
// 选取[newRecordTime-filterCycleHour, newRcordTime]之间的记录做平滑
|
||||||
// 如果这个时间段的记录数少于FILTER_MIN_RECORD_NUM,本次不做平滑
|
// 如果这个时间段的记录数少于FILTER_MIN_RECORD_NUM,本次不做平滑
|
||||||
@ -160,12 +153,15 @@ public class GNSSDeviceLocationRecordServiceImpl implements GNSSDeviceLocationRe
|
|||||||
}
|
}
|
||||||
logger.info(deviceId + " filter records num: " + count);
|
logger.info(deviceId + " filter records num: " + count);
|
||||||
if (count >= FILTER_MIN_RECORD_NUM) {
|
if (count >= FILTER_MIN_RECORD_NUM) {
|
||||||
return new double[]{sumE / count, sumN / count, sumD / count};
|
newRecord.setRb562e(NumberUtils.scaleTwo(sumE / count));
|
||||||
|
newRecord.setRb562n(NumberUtils.scaleTwo(sumN / count));
|
||||||
|
newRecord.setRb562d(NumberUtils.scaleTwo(sumD / count));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -223,4 +219,24 @@ public class GNSSDeviceLocationRecordServiceImpl implements GNSSDeviceLocationRe
|
|||||||
}
|
}
|
||||||
return filterCycle;
|
return filterCycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRb562(String deviceId, LocalDateTime afterTime){
|
||||||
|
// 获取平滑参数
|
||||||
|
//refreshCalcParams(gnssDevice.getCalc_group_id());
|
||||||
|
LocalDateTime beforTime = afterTime.plusHours(shortCycleHour);
|
||||||
|
QueryWrapper<GnssCalcData> query = new QueryWrapper<>();
|
||||||
|
query.eq("deviceid", deviceId);
|
||||||
|
query.ge("createtime", beforTime.format(dateFormatter));
|
||||||
|
query.le("createtime", afterTime.format(dateFormatter));
|
||||||
|
|
||||||
|
List<GnssCalcData> calcDataListToUpdate = repository.selectList(query);
|
||||||
|
for(GnssCalcData calcData:calcDataListToUpdate){
|
||||||
|
if(calcData.getEnabled() && calcData.getRb562e()==null) {
|
||||||
|
calcFilterLocation(calcData, shortCycleHour);
|
||||||
|
repository.updateById(calcData);
|
||||||
|
logger.info(deviceId + " update rb562");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user