From bf214698a65a9a076d3bc822591f54b09a6a1532 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 15 Oct 2020 15:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8D=E6=AD=A3=E5=88=87=E5=87=BD=E6=95=B0?= =?UTF-8?q?=20=E5=85=BC=E5=AE=B9=E6=AD=A3=E8=B4=9F=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../support/normalizing/batch/BatchScoreCalculator.java | 7 ++++++- .../com/epmet/stats/test/normalizing/MathUtilTest.java | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 75e78ea215..b4f2fd4677 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -1,5 +1,6 @@ package com.epmet.support.normalizing.batch; +import com.epmet.support.normalizing.Correlation; import com.epmet.support.normalizing.ScoreCalculator; import java.math.BigDecimal; @@ -70,9 +71,13 @@ public class BatchScoreCalculator { if (maxValue.compareTo(minValue) == 0) { //*((max-min)/ (Math.PI/2))+min //Math.atan(new Double(vo.getSampleValue().toString()))* - normalizeValue = new BigDecimal(Math.atan(new Double(vo.getSampleValue().toString()))) + normalizeValue = new BigDecimal(Math.atan(new Double(getFinalSampleValue(vo.getSampleValue(), threshold).toString()))) .multiply( (maxValue.subtract(minValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.UNNECESSARY))).add(minValue).setScale(6, RoundingMode.HALF_UP); + // + if (scoreCalculator.getCorrelation().getCode().equals(Correlation.NEGATIVE)) { + normalizeValue = maxValue.subtract(normalizeValue); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java index ff0811d4c5..408f837691 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/normalizing/MathUtilTest.java @@ -20,7 +20,7 @@ public class MathUtilTest { BigDecimal maxValue = new BigDecimal(100); BigDecimal minValue = new BigDecimal(60); - BigDecimal normalizeValue = new BigDecimal(Math.atan(new Double("4"))) + BigDecimal normalizeValue = new BigDecimal(Math.atan(new Double("0"))) .multiply( (maxValue.subtract(minValue).divide(new BigDecimal(Math.PI / 2), 10, RoundingMode.HALF_UP))).add(minValue).setScale(6, RoundingMode.HALF_UP); System.out.println(normalizeValue);