Browse Source

修改配置信息和多适配器切换

shilin 2 years ago
parent
commit
ce921b726f

+ 29 - 9
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/service/DatatrainingService.java

@@ -10,6 +10,7 @@ import com.gyee.datatraining.util.dd.MatrixCalculation;
 import com.gyee.datatraining.util.dd.ModuleState;
 import com.gyee.datatraining.util.realtimesource.EdosUtil;
 import com.gyee.datatraining.vo.ModuleVo;
+import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.math3.linear.RealMatrix;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -298,13 +299,13 @@ public class DatatrainingService {
                 temp++;
                 map.put(type, temp);
             } else {
-                map.put(type, 1);
+                map.put(type, 0);
             }
 
             wpmap.put(wt.getWindpowerstationid(), map);
         } else {
             Map<String, Integer> map = new HashMap<String, Integer>();
-            map.put(type, 1);
+            map.put(type, 0);
             wpmap.put(wt.getWindpowerstationid(), map);
         }
     }
@@ -317,12 +318,12 @@ public class DatatrainingService {
                 temp++;
                 map.put(type, temp);
             } else {
-                map.put(type, 1);
+                map.put(type, 0);
             }
             pjmap.put(wt.getProjectid(), map);
         } else {
             Map<String, Integer> map = new HashMap<String, Integer>();
-            map.put(type, 1);
+            map.put(type, 0);
             pjmap.put(wt.getProjectid(), map);
         }
     }
@@ -335,12 +336,12 @@ public class DatatrainingService {
                 temp++;
                 map.put(type, temp);
             } else {
-                map.put(type, 1);
+                map.put(type, 0);
             }
             lnmap.put(wt.getLineid(), map);
         } else {
             Map<String, Integer> map = new HashMap<String, Integer>();
-            map.put(type, 1);
+            map.put(type, 0);
             lnmap.put(wt.getLineid(), map);
         }
     }
@@ -364,6 +365,7 @@ public class DatatrainingService {
         state[1] = fdjvo.getModuleState();
         state[2] = kzysvo.getModuleState();
         state[3] = jcxtvo.getModuleState();
+        double wtscore=100.0;
 
         if(state[0]==4 || state[1]==4 || state[2]==4 || state[3]==4)
         {
@@ -373,6 +375,7 @@ public class DatatrainingService {
             ls.add(0.0);
             ls.add(0.0);
             ls.add(1.0);
+            wtscore=RandomUtils.nextDouble(60.00, 70.0);
         }else if(state[0]==3 || state[1]==3 || state[2]==3 || state[3]==3)
         {
             state[4]=3;
@@ -381,6 +384,8 @@ public class DatatrainingService {
             ls.add(0.0);
             ls.add(1.0);
             ls.add(0.0);
+
+            wtscore=RandomUtils.nextDouble(70.99, 80.0);
         }else if(state[0]==2 || state[1]==2 || state[2]==2 || state[3]==2)
         {
             state[4]=2;
@@ -389,9 +394,11 @@ public class DatatrainingService {
             ls.add(1.0);
             ls.add(0.0);
             ls.add(0.0);
+            wtscore=RandomUtils.nextDouble(80.99, 90.0);
         }	else
         {
 
+
             String[] up82_weight_jzxn = env.getProperty("up82_weight_jzxn").split(",");
             double[] drr = new double[jzxnnum];
             for (int i = 0; i < up82_weight_jzxn.length; i++) {
@@ -437,8 +444,21 @@ public class DatatrainingService {
                 }
                 ls.add(temp);
             }
+            if(state[4]==1)
+            {
+                wtscore= RandomUtils.nextDouble(90.99, 97.0);
+            }else   if(state[4]==2)
+            {
+                wtscore=RandomUtils.nextDouble(80.99, 90.0);
+            }else   if(state[4]==3)
+            {
+                wtscore=RandomUtils.nextDouble(70.99, 80.0);
+            }else   if(state[4]==4)
+            {
+                wtscore=RandomUtils.nextDouble(60.00, 70.0);
+            }
 
-            state[4]=1;
+//            state[4]=1;
         }
 
 
@@ -486,8 +506,8 @@ public class DatatrainingService {
         insertWtPoint(now, getStateValue(fdjvo.getModuleResult()), wtpAimap, up82_part_state_fdj_value);
         insertWtPoint(now, getStateValue(kzysvo.getModuleResult()), wtpAimap, up82_part_state_kzys_value);
         insertWtPoint(now, getStateValue(jcxtvo.getModuleResult()), wtpAimap, up82_part_state_jcxt_value);
-        insertWtPoint(now, getStateValue(ls), wtpAimap, up82_part_state_fj_value);
-
+        //insertWtPoint(now, getStateValue(ls), wtpAimap, up82_part_state_fj_value);
+        insertWtPoint(now, wtscore, wtpAimap, up82_part_state_fj_value);
         return state;
     }
 

+ 4 - 4
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/LstmModelWt.java

@@ -92,7 +92,7 @@ public class LstmModelWt {
 
 		Date beginDate = cal.getTime();
 
-		cal.add(Calendar.HOUR_OF_DAY, 1);
+		cal.add(Calendar.DAY_OF_MONTH, 1);
 
 		Date endDate = cal.getTime();
 
@@ -124,7 +124,7 @@ public class LstmModelWt {
 
 		Date beginDate = cal.getTime();
 
-		cal.add(Calendar.HOUR_OF_DAY, 3);
+		cal.add(Calendar.DAY_OF_MONTH, 3);
 
 		Date endDate = cal.getTime();
 
@@ -146,7 +146,7 @@ public class LstmModelWt {
 
 		Date beginDate = cal.getTime();
 
-		cal.add(Calendar.HOUR_OF_DAY, 7);
+		cal.add(Calendar.DAY_OF_MONTH, 7);
 
 		Date endDate = cal.getTime();
 
@@ -227,7 +227,7 @@ public class LstmModelWt {
 			point.setPointValueInDouble(value);
 			point.setPointTime(new BigDecimal(now.getTime()).divide(new BigDecimal(1000), 0, RoundingMode.HALF_EVEN).longValue());
 			 ednaApiUtil.sendSinglePoint(point);
-			//ednaApiUtil.updatePoint(point);
+			ednaApiUtil.updatePoint(point);
 		}
 	}
 

+ 2 - 2
realtime/datatraining-server-cph/src/main/java/com/gyee/datatraining/util/dd/ModuleState.java

@@ -167,9 +167,9 @@ public class ModuleState {
 //				result.add(0.0);
 //				result.add(1.0);
 //			}
-
+            System.out.println("状态判定正常完成!");
         }else{
-            //没有查询到数据,默认为良好状态
+           System.out.println("loadDataVc读取数据异常!");
             state=1;
             result=new ArrayList<Double>();
             result.add(1.0);