|
@@ -0,0 +1,83 @@
|
|
|
+package com.gyee.power.fitting.service.custom.temperature;
|
|
|
+
|
|
|
+import com.gyee.power.fitting.common.alg.PowerTemperatureAlg;
|
|
|
+import com.gyee.power.fitting.common.spring.InitialRunner;
|
|
|
+import com.gyee.power.fitting.common.util.FileUtil;
|
|
|
+import com.gyee.power.fitting.model.Modelpowerdetails;
|
|
|
+import com.gyee.power.fitting.model.Powerfittinganalysis;
|
|
|
+import com.gyee.power.fitting.model.custom.PowerPointData;
|
|
|
+import com.gyee.power.fitting.service.PowerfittinganalysisService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+@Service
|
|
|
+public class PowerTemperatureService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PowerfittinganalysisService powerService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 与温度有关的额定功率
|
|
|
+ * @param ids
|
|
|
+ */
|
|
|
+ public Object ratedPower(String ids) {
|
|
|
+ List<Powerfittinganalysis> list = powerService.selectListByIds(ids);
|
|
|
+ if (list == null || list.size() == 0)
|
|
|
+ return null;
|
|
|
+
|
|
|
+ List<Object> result = new ArrayList<>();
|
|
|
+ for (Powerfittinganalysis obj : list){
|
|
|
+ List<Modelpowerdetails> ls = InitialRunner.modelPowerDetailMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid());
|
|
|
+ Double theoryPower = ls.get(ls.size() - 1).getTheorypower(); //理论功率
|
|
|
+ Map<String, Object> map = csvParse(obj);//数据解析
|
|
|
+ List<PowerPointData> data = (List<PowerPointData>) map.get("data");
|
|
|
+ Object res = PowerTemperatureAlg.temperatureRatedPower(data, theoryPower, (Double) map.get("minT"), (Double) map.get("maxT"));
|
|
|
+ List<int[]> rp = PowerTemperatureAlg.temperatureRatedPower(data);
|
|
|
+
|
|
|
+ Map<String, Object> mp = new HashMap<>();
|
|
|
+ mp.put("wt", obj.getWindturbine());
|
|
|
+ mp.put("power", InitialRunner.equipmentMap.get(InitialRunner.wtMap.get(obj.getWindturbine()).getModelid()));
|
|
|
+ mp.put("res1", res);
|
|
|
+ mp.put("res2", rp);
|
|
|
+ result.add(mp);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * csv 文件解析成对象
|
|
|
+ * @param obj
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Map<String, Object> csvParse(Powerfittinganalysis obj){
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ double minT = 0.0;
|
|
|
+ double maxT = 0.0;
|
|
|
+ List<PowerPointData> ls = new ArrayList<>();
|
|
|
+ List<String> content = FileUtil.readFile(obj.getPath(), true);
|
|
|
+ for (int i = 1; i < content.size(); i++){
|
|
|
+ String[] split = content.get(i).split(",");
|
|
|
+ PowerPointData data = new PowerPointData(split, true);
|
|
|
+ if (data.getSpeed() < 0 || data.getPower() < 0)
|
|
|
+ continue;
|
|
|
+ data.setWtId(obj.getWindturbine());
|
|
|
+
|
|
|
+ minT = data.getHjwd() < minT ? data.getHjwd() : minT;
|
|
|
+ maxT = data.getHjwd() > maxT ? data.getHjwd() : maxT;
|
|
|
+ ls.add(data);
|
|
|
+ }
|
|
|
+ map.put("data", ls);
|
|
|
+ map.put("minT", minT);
|
|
|
+ map.put("maxT", maxT);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+}
|