|
|
@@ -28,9 +28,7 @@ public class PLCUtils {
|
|
|
// 获取参数
|
|
|
public static QmParam getParameter(S7PLC plc) {
|
|
|
// TODO
|
|
|
- // 泄露值
|
|
|
String leakageValue = "0.0";
|
|
|
- leakageValue = plc.readString("VB307", 7);
|
|
|
// 结果
|
|
|
String result = getResult(plc);
|
|
|
// 检测压
|
|
|
@@ -47,7 +45,6 @@ public class PLCUtils {
|
|
|
String loopTime = Math.round(plc.readInt16("VW850") / 10.0) + "";
|
|
|
|
|
|
QmParam qmParam = new QmParam();
|
|
|
- qmParam.setLeakVal(leakageValue);
|
|
|
qmParam.setLeakRateUnit("kPa");
|
|
|
qmParam.setLeakValUnit("kPa");
|
|
|
qmParam.setTestPressure(pressure);
|
|
|
@@ -58,6 +55,25 @@ public class PLCUtils {
|
|
|
qmParam.setCsDuration(detectTime);
|
|
|
qmParam.setDeviceType(MesClient.csyq);
|
|
|
qmParam.setTestPace(loopTime);
|
|
|
+ long start = System.currentTimeMillis();
|
|
|
+ final long MAX_WAIT = 3000;
|
|
|
+ while (true){
|
|
|
+ leakageValue = plc.readString("VB307", 7);
|
|
|
+ // 条件1:读取到非空,直接跳出循环
|
|
|
+ if (leakageValue != null && !leakageValue.trim().isEmpty()) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
+ if (now - start >= MAX_WAIT) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Thread.sleep(50);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ qmParam.setLeakVal(leakageValue);
|
|
|
return qmParam;
|
|
|
}
|
|
|
|