浏览代码

动液面采集数据入库前增加深度压差、流动压差计算值

chenwen 1 年之前
父节点
当前提交
8de33b3d14

+ 32 - 0
src/main/java/com/hb/proj/gather/process/LiquidCalculator.java

@@ -3,6 +3,7 @@ package com.hb.proj.gather.process;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.hb.proj.gather.model.LiquidVO;
 import com.hb.proj.gather.model.WellMeasurePO;
 
 
@@ -47,4 +48,35 @@ public class LiquidCalculator {
 		}
 		
 	}
+	
+	/**
+	 * 计算深度压差
+	 * @param cvtLiquidDepth 折算动液面深度
+	 * @param lastStaticLiquid 静液面数据对象
+	 * @return
+	 */
+	public static Double calcDepthDiff(Double cvtLiquidDepth,LiquidVO lastStaticLiquid) {
+		if(cvtLiquidDepth==null || lastStaticLiquid==null || lastStaticLiquid.getLiquidDepthConvert()==null) {
+			return null;
+		}
+		return cvtLiquidDepth.doubleValue()-lastStaticLiquid.getLiquidDepthConvert().doubleValue();
+	}
+	
+	/**
+	 * 计算流动压差KPa【压力(KPa)=(深度差(m)*液体密度(Kg/L)*重力加速度(m/s2))】
+	 * @param depthDiff
+	 * @param lastMeasure
+	 * @return
+	 */
+	public static Double calcFlowPreeDiff(Double depthDiff,WellMeasurePO lastMeasure) {
+		if(depthDiff==null || lastMeasure==null) {
+			return null;
+		}
+		
+		if(lastMeasure.getMixLiquidDensity()==null || lastMeasure.getGravity()==null) {
+			return null;
+		}
+		
+		return depthDiff.doubleValue()*lastMeasure.getMixLiquidDensity().doubleValue()*lastMeasure.getGravity().doubleValue();
+	}
 }

+ 14 - 3
src/main/java/com/hb/proj/gather/rep/GatherDataRepService.java

@@ -130,8 +130,8 @@ public class GatherDataRepService {
 	public void save(LiquidPO  liquidPO) {
 		String sql="""
 				insert into tzl_gather_data_liquid(well_id,test_time,liquid_datas,hoop_datas,sound_speed_dev,liquid_depth_dev,casing_press_dev,create_time,del_if,battery_voltage,
-				sound_speed_calc,liquid_depth,liquid_depth_convert,liquid_depth_static,liquid_depth_static_convert) 
-				values(?,?,?,?,?,?,?,now(),false,?,?,?,?,?,?)
+				sound_speed_calc,liquid_depth,liquid_depth_convert,depth_diff,flow_press_diff,liquid_depth_static,liquid_depth_static_convert) 
+				values(?,?,?,?,?,?,?,now(),false,?,?,?,?,?,?,?,?)
 				""";
 		
 		
@@ -154,8 +154,19 @@ public class GatherDataRepService {
 		val=liquidPO.getLiquidDepthDev()*(lastSSLiquid!=null && lastSSLiquid.getSoundSpeedFactor()!=null?lastSSLiquid.getSoundSpeedFactor():1);
 		args.add(val);
 		
+		
+		WellMeasurePO lastMeasure=getLastMeasure(liquidPO.getWellId());
+		
 		//折算动液面深度
-		val=LiquidCalculator.calcConvertLiquidDepth(val, liquidPO.getCasingPressDev(), getLastMeasure(liquidPO.getWellId()));
+		val=LiquidCalculator.calcConvertLiquidDepth(val, liquidPO.getCasingPressDev(), lastMeasure);
+		args.add(val);
+		
+		//深度压差
+		val=LiquidCalculator.calcDepthDiff(val, lastStaticLiquid);
+		args.add(val);
+		
+		//流动压差
+		val=LiquidCalculator.calcFlowPreeDiff(val, lastMeasure);
 		args.add(val);
 		
 		//静液面深度