| | |
| | | |
| | | |
| | | /*获取衰减(新)*/ |
| | | public List<NA7672LValueVO> getDecayListNew(int channelId, int traceId, int fetchType, String returnType, double temperture, double length) { |
| | | List<NA7672LValueVO> returnValueList = new ArrayList<>(); |
| | | try { |
| | | this.initTCP(); |
| | | InputStream inputStream = this.socket.getInputStream(); |
| | | OutputStream outputStream = this.socket.getOutputStream(); |
| | | // 把字节流转换成字符流 |
| | | PrintWriter printWriter = new PrintWriter(outputStream); |
| | | Scanner inFromSocket = new Scanner(inputStream); |
| | | //获取mark的x |
| | | for (int markId = 1; markId <= 16; markId++) { |
| | | NA7672LValueVO returnValue = new NA7672LValueVO(); |
| | | String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?"; |
| | | printWriter.println(requestString); |
| | | printWriter.flush(); |
| | | String responseString = inFromSocket.next(); |
| | | BigDecimal val = new BigDecimal(responseString); |
| | | BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING); |
| | | returnValue.setLabel(returnType + "_" + valRound.toString() + "m"); |
| | | //获取mark的y |
| | | requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?"; |
| | | printWriter.println(requestString); |
| | | printWriter.flush(); |
| | | responseString = inFromSocket.next(); |
| | | String[] valList = responseString.split(","); |
| | | val = new BigDecimal(valList[0]); |
| | | val.setScale(4, RoundingMode.HALF_UP); |
| | | returnValue.setDecimalVal(val); |
| | | /*类别衰减、通道、轨迹线、mark*/ |
| | | returnValue.setFetchType(fetchType); |
| | | returnValue.setChannel(channelId); |
| | | returnValue.setTrace(traceId); |
| | | returnValue.setChannel(channelId); |
| | | returnValue.setMark(markId); |
| | | returnValueList.add(returnValue); |
| | | } |
| | | this.closeTcp(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | for (NA7672LValueVO one : returnValueList) { |
| | | /*获取计算值*/ |
| | | /*衰减的温度系数换算公式 = 1+0.002×(实际温度-20℃) |
| | | 测试值÷长度÷温度系数×100*/ |
| | | double wd = 1 + 0.002 * (temperture - 20); |
| | | double decay_cal = one.getDecimalVal().doubleValue() / length / wd * 100; |
| | | one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP)); |
| | | } |
| | | return returnValueList; |
| | | } |
| | | // public List<NA7672LValueVO> getDecayListNew(int channelId, int traceId, int fetchType, String returnType, double temperture, double length) { |
| | | // List<NA7672LValueVO> returnValueList = new ArrayList<>(); |
| | | // try { |
| | | // this.initTCP(); |
| | | // InputStream inputStream = this.socket.getInputStream(); |
| | | // OutputStream outputStream = this.socket.getOutputStream(); |
| | | // // 把字节流转换成字符流 |
| | | // PrintWriter printWriter = new PrintWriter(outputStream); |
| | | // Scanner inFromSocket = new Scanner(inputStream); |
| | | // //获取mark的x |
| | | // for (int markId = 1; markId <= 16; markId++) { |
| | | // NA7672LValueVO returnValue = new NA7672LValueVO(); |
| | | // String requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":X?"; |
| | | // printWriter.println(requestString); |
| | | // printWriter.flush(); |
| | | // String responseString = inFromSocket.next(); |
| | | // BigDecimal val = new BigDecimal(responseString); |
| | | // BigDecimal valRound = val.divide(new BigDecimal(1000 * 1000), 0, RoundingMode.CEILING); |
| | | // returnValue.setLabel(returnType + "_" + valRound.toString() + "m"); |
| | | // //获取mark的y |
| | | // requestString = ":CALC" + channelId + ":TRAC" + traceId + ":MARK" + markId + ":Y?"; |
| | | // printWriter.println(requestString); |
| | | // printWriter.flush(); |
| | | // responseString = inFromSocket.next(); |
| | | // String[] valList = responseString.split(","); |
| | | // val = new BigDecimal(valList[0]); |
| | | // val.setScale(4, RoundingMode.HALF_UP); |
| | | // returnValue.setDecimalVal(val); |
| | | // /*类别衰减、通道、轨迹线、mark*/ |
| | | // returnValue.setFetchType(fetchType); |
| | | // returnValue.setChannel(channelId); |
| | | // returnValue.setTrace(traceId); |
| | | // returnValue.setChannel(channelId); |
| | | // returnValue.setMark(markId); |
| | | // returnValueList.add(returnValue); |
| | | // } |
| | | // this.closeTcp(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // for (NA7672LValueVO one : returnValueList) { |
| | | // /*获取计算值*/ |
| | | // /*衰减的温度系数换算公式 = 1+0.002×(实际温度-20℃) |
| | | // 测试值÷长度÷温度系数×100*/ |
| | | // double wd = 1 + 0.002 * (temperture - 20); |
| | | // double decay_cal = one.getDecimalVal().doubleValue() / length / wd * 100; |
| | | // one.setMeasureValue(new BigDecimal(decay_cal).setScale(4, RoundingMode.HALF_UP)); |
| | | // } |
| | | // return returnValueList; |
| | | // } |
| | | |
| | | /*获取驻波比(新)*/ |
| | | public NA7672LValueVO getSWRNew(int channelId, int fetchType) { |