|
@@ -1,10 +1,15 @@
|
|
|
package com.hb.proj.gather.process;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
+import com.hb.proj.gather.model.LiquidExtraVO;
|
|
|
import com.hb.proj.gather.model.LiquidPO;
|
|
|
+import com.hb.proj.gather.model.WellDeviationPO;
|
|
|
+import com.hb.proj.gather.model.WellMeasurePO;
|
|
|
import com.hb.proj.gather.rep.GatherDataRepService;
|
|
|
import com.hb.proj.gather.rep.WellConfigService;
|
|
|
import com.hb.xframework.util.ApplicationContextUtils;
|
|
@@ -22,6 +27,7 @@ public class DataTransRepLiquidTask implements Runnable {
|
|
|
@Override
|
|
|
public void run() {
|
|
|
logger.info("开始动液面数据转换处理{}",po.getDevSerial());
|
|
|
+ long t1=System.currentTimeMillis();
|
|
|
try {
|
|
|
WellConfigService configService=ApplicationContextUtils.getBean("wellConfigService", WellConfigService.class);
|
|
|
String wellId=configService.getWellIdByDev(po.getDevSerial());
|
|
@@ -32,8 +38,11 @@ public class DataTransRepLiquidTask implements Runnable {
|
|
|
po.setWellId(wellId);
|
|
|
|
|
|
GatherDataRepService repService=ApplicationContextUtils.getBean("gatherDataRepService", GatherDataRepService.class);
|
|
|
- repService.save(po);
|
|
|
- logger.info("动液面数据入库完成{}",po.getDevSerial());
|
|
|
+
|
|
|
+ LiquidExtraVO liquidExtra=calcExtra(po,repService);
|
|
|
+
|
|
|
+ repService.save(po,liquidExtra);
|
|
|
+ logger.info("动液面数据入库完成{},耗时:{}",po.getDevSerial(),System.currentTimeMillis()-t1);
|
|
|
}
|
|
|
catch(Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -41,5 +50,80 @@ public class DataTransRepLiquidTask implements Runnable {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 动液面衍生数据计算
|
|
|
+ * @param liquid
|
|
|
+ * @param repService
|
|
|
+ */
|
|
|
+ private LiquidExtraVO calcExtra(LiquidPO liquid,GatherDataRepService repService) {
|
|
|
+ LiquidExtraVO lastSSLiquid=repService.getLastLiquidCalcViaSoundSpeed(liquid.getWellId());
|
|
|
+ LiquidExtraVO lastStaticLiquid=repService.getLastLiquidStaticCalc(liquid.getWellId());
|
|
|
+ WellMeasurePO lastMeasure=repService.getLastMeasure(liquid.getWellId());
|
|
|
+
|
|
|
+ //当前动液面数据对应的衍生数据对象
|
|
|
+ LiquidExtraVO curExtra=new LiquidExtraVO();
|
|
|
+ curExtra.setWellId(liquid.getWellId());
|
|
|
+
|
|
|
+ //校正音速=最新一次手动音速法计算时设置的音速
|
|
|
+ Double val=lastSSLiquid!=null && lastSSLiquid.getSoundSpeed()!=null?lastSSLiquid.getSoundSpeed():null;
|
|
|
+ curExtra.setSoundSpeedCalc(val);
|
|
|
+
|
|
|
+ //校正液面深度=设备采集深度*最新手动音速法计算时设置的k系数
|
|
|
+ val=liquid.getLiquidDepthDev()*(lastSSLiquid!=null && lastSSLiquid.getSoundSpeedFactor()!=null?lastSSLiquid.getSoundSpeedFactor():1);
|
|
|
+ curExtra.setLiquidDepth(val);
|
|
|
+
|
|
|
+ //折算动液面深度
|
|
|
+ val=LiquidCalculator.calcConvertLiquidDepth(curExtra.getLiquidDepth(), liquid.getCasingPressDev(), lastMeasure);
|
|
|
+ curExtra.setLiquidDepthConvert(val);
|
|
|
+
|
|
|
+ //静液面深度=最近一次静液测算时的静液面深度=测算时的校正液面深度;
|
|
|
+ curExtra.setLiquidDepthStatic(lastStaticLiquid!=null?lastStaticLiquid.getLiquidDepthStatic():null);
|
|
|
+
|
|
|
+ //折算静深度=最近一次静液测算的值=测算时的折算液面深度
|
|
|
+ curExtra.setLiquidDepthStaticConvert(lastStaticLiquid!=null?lastStaticLiquid.getLiquidDepthStaticConvert():null);
|
|
|
+
|
|
|
+ //深度压差=折算动液面深度-折算静液面深度=折算动液面深度-最近一次静液测算折算静液面深度=折算动液面深度-最近一次静液测算时折算动液面深度
|
|
|
+ Double depth1=calcVDepth(curExtra.getLiquidDepthConvert(),liquid.getWellId(),repService);
|
|
|
+ Double depth2=calcVDepth(curExtra.getLiquidDepthStaticConvert(),liquid.getWellId(),repService);
|
|
|
+
|
|
|
+ curExtra.setDepthDiff(LiquidCalculator.calcDepthDiff(depth1,depth2));
|
|
|
+
|
|
|
+ //流动压差
|
|
|
+ curExtra.setFlowPressDiff(LiquidCalculator.calcFlowPreeDiff(curExtra.getDepthDiff(), lastMeasure));
|
|
|
+
|
|
|
+ return curExtra;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过井斜数据插值计算指定值垂直深度
|
|
|
+ * @param injectDepth
|
|
|
+ * @param wellId
|
|
|
+ * @param repService
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Double calcVDepth(Double injectDepth,String wellId,GatherDataRepService repService) {
|
|
|
+ Double vDepth=injectDepth;
|
|
|
+ List<WellDeviationPO> wds=repService.loadNearDeviation(wellId, injectDepth);
|
|
|
+ if(wds!=null && wds.size()==1) { //等于或超过最大井斜数据
|
|
|
+ if(injectDepth.doubleValue()==wds.get(0).getMeasureDepth().doubleValue()) { //等于最大斜深,直接取其垂深
|
|
|
+ vDepth=wds.get(0).getVerticalDepth();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ wds=repService.loadNearDeviation(wellId, wds.get(0).getMeasureDepth().doubleValue()-10); //超过最大斜深,取最后两个斜深记录
|
|
|
+ vDepth=DeviationCalculator.calc(wds.get(0), wds.get(1), injectDepth);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(wds!=null && wds.size()==2) { //找到前后插值
|
|
|
+ if(injectDepth.doubleValue()==wds.get(0).getMeasureDepth().doubleValue()) { //等于前一斜深,直接取其垂深
|
|
|
+ vDepth=wds.get(0).getVerticalDepth();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ wds.get(1).setMeasureDepth(injectDepth); //根据插值公式要求,后一邻近值的测量深度替换为被插值
|
|
|
+ vDepth=DeviationCalculator.calc(wds.get(0), wds.get(1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vDepth;
|
|
|
+ }
|
|
|
|
|
|
}
|