Browse Source

评分计算修改

lmstack 3 years ago
parent
commit
94caa5d8c3
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/main/java/com/lm/lib/controller/ShowDataController.java

+ 8 - 3
src/main/java/com/lm/lib/controller/ShowDataController.java

@@ -225,9 +225,14 @@ public Map<String, Object> gpsInfo() throws IOException {
                 Double soh = sohData == null ? Double.parseDouble(lastData.get("soh").toString()) : Double.parseDouble(sohData.get("soh").toString());
 
                 lastData.put("error_level", lastData.get("error_level") == null ? 0 : lastData.get("error_level"));
-                score = (soh * soh * 14.0 / 100.0 + (4 - (Integer) lastData.get("error_level") * 25 * 5) + 1 * 100 * 0.1
-                        + (((600 - (Double.parseDouble(Collections.max(voltages)) - (Double.parseDouble(Collections.min(voltages))))) / 6) *
-                        ((600 - (Double.parseDouble(Collections.max(voltages)) - (Double.parseDouble(Collections.min(voltages))))) / 6) * 6 / 100)) / 25.1;
+                Double voltDiff = (600 - (Double.parseDouble(Collections.max(voltages)) - (Double.parseDouble(Collections.min(voltages))))) / 6;
+                if (soh.compareTo(100.0) > 0){
+                    soh = 100.0;
+                }
+                score = (soh * soh * 14.0 / 100.0 +
+                        (4 - (Integer) lastData.get("error_level")) * 25 * 5 +
+                        1 * 100 * 0.1 +
+                        (voltDiff * voltDiff * 6 / 100)) / 25.1;
 
                 rspRealTimeInfo.setScore(score.toString());
                 if (((Integer) lastData.get("charge_state")).equals(0)) {