| | |
| | | } |
| | | MmItemOutputEntity outPut = mmItemOutputService.getByItemid(predictItem.getId(), itemNo[1], itemNo[2]); |
| | | String outputId = outPut.getId(); |
| | | // 如果第5个参数为1,则取累计值 |
| | | if ("1".equals(itemNo[4])){ |
| | | outputId = outPut.getId() + CommonDict.CUMULANT_SUFFIX; |
| | | // 判断是否有第五个参数,如果有第5个参数为1,则取累计值 |
| | | if (itemNo.length >= 5){ |
| | | if (StringUtils.isNotBlank(itemNo[4]) && "1".equals(itemNo[4])){ |
| | | outputId = outPut.getId() + CommonDict.CUMULANT_SUFFIX; |
| | | } |
| | | } |
| | | Date predictTime = predictItem.getLastTime(); |
| | | List<Object[]> curData = mmItemResultJsonService.getData(outputId, predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | |
| | | }); |
| | | chartParamService.updateByChartIdAndParamCode(chartParams); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 计算功率因数 p²/(根号:p²+Q²) |
| | | **/ |
| | | public Double calculateCos(Double PValue,Double QValue) { |
| | | // 绝对值 |
| | | PValue = Math.abs(PValue); |
| | | QValue = Math.abs(QValue); |
| | | //PValue [0,0.001] 直接判断为关闭返回0 |
| | | if (PValue >= 0 && PValue <= 0.001) { |
| | | return 0.0; |
| | | }else { |
| | | BigDecimal result = new BigDecimal(PValue).divide(BigDecimal.valueOf(Math.sqrt(Math.pow(PValue, 2) + Math.pow(QValue, 2))), 2, BigDecimal.ROUND_HALF_UP); |
| | | return result.doubleValue(); |
| | | } |
| | | } |
| | | |
| | | private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { |