|
@@ -22,6 +22,7 @@ import com.gyee.power.fitting.service.IWindpowerstationtestingpoint2Service;
|
|
import com.gyee.power.fitting.service.Windturbinetestingpointai2Service;
|
|
import com.gyee.power.fitting.service.Windturbinetestingpointai2Service;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
|
import org.apache.commons.math3.fitting.WeightedObservedPoints;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -48,6 +49,12 @@ public class IvPvCurveFittingService {
|
|
@Resource
|
|
@Resource
|
|
private AnnotationTool annotationTool;
|
|
private AnnotationTool annotationTool;
|
|
|
|
|
|
|
|
+ private List<FixedVo> fixedVos;
|
|
|
|
+ private Map<String, String> uniforcodes;
|
|
|
|
+
|
|
|
|
+ @Value("${gf3xjscz}")
|
|
|
|
+ private String gf3xjscz;
|
|
|
|
+
|
|
|
|
|
|
public void getDatas2File(String stationid, long start, long end) {
|
|
public void getDatas2File(String stationid, long start, long end) {
|
|
|
|
|
|
@@ -66,13 +73,12 @@ public class IvPvCurveFittingService {
|
|
private void infos2File(List<List<PhotovoltaicInfo>> datas) {
|
|
private void infos2File(List<List<PhotovoltaicInfo>> datas) {
|
|
|
|
|
|
//文件第一行
|
|
//文件第一行
|
|
- List<FixedVo> fixedVos = annotationTool.getFixedVoList(PhotovoltaicInfo.class);
|
|
|
|
- String columnName = fixedVos.stream().map(FixedVo::getDes).collect(Collectors.joining(","));
|
|
|
|
|
|
+ String columnName = getFixedVos().stream().map(FixedVo::getDes).collect(Collectors.joining(","));
|
|
//遍历逆变器
|
|
//遍历逆变器
|
|
for (List<PhotovoltaicInfo> data : datas) {
|
|
for (List<PhotovoltaicInfo> data : datas) {
|
|
PhotovoltaicInfo info = data.get(0);
|
|
PhotovoltaicInfo info = data.get(0);
|
|
String station = info.getStation();
|
|
String station = info.getStation();
|
|
- String fileName = config.getFilePathPrepare() + "gf\\" + station + "-" + info.getInverter() + "-" + DateUtils.date2StringS(new Date(info.getTime())) + ".csv";
|
|
|
|
|
|
+ String fileName = config.getGfDataPath() + station + "-" + info.getInverter() + "-" + DateUtils.date2StringS(new Date(info.getTime())) + ".csv";
|
|
File file = new File(fileName);
|
|
File file = new File(fileName);
|
|
if (file.exists()) continue;
|
|
if (file.exists()) continue;
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
@@ -115,10 +121,9 @@ public class IvPvCurveFittingService {
|
|
}
|
|
}
|
|
|
|
|
|
public Map<String, Object> getTable(String s) {
|
|
public Map<String, Object> getTable(String s) {
|
|
- List<FixedVo> fixedVos = annotationTool.getFixedVoList(PhotovoltaicInfo.class);
|
|
|
|
- List<TableTitle> collect = fixedVos.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
|
|
|
|
|
|
+ List<TableTitle> collect = getFixedVos().stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
|
|
Map<String, Object> tableMap = new HashMap<>();
|
|
Map<String, Object> tableMap = new HashMap<>();
|
|
- String fs = config.getFilePathPrepare() + "gf\\" + s;
|
|
|
|
|
|
+ String fs = config.getGfDataPath() + s;
|
|
List<PhotovoltaicInfo> infos = file2Info(fs, false);
|
|
List<PhotovoltaicInfo> infos = file2Info(fs, false);
|
|
tableMap.put("data", infos);
|
|
tableMap.put("data", infos);
|
|
tableMap.put("title", collect);
|
|
tableMap.put("title", collect);
|
|
@@ -169,17 +174,24 @@ public class IvPvCurveFittingService {
|
|
List<PhotovoltaicInfo> bzclds = file2Info(bzcldPath, true);
|
|
List<PhotovoltaicInfo> bzclds = file2Info(bzcldPath, true);
|
|
Map<String, PhotovoltaicInfo> bzcldMap = bzclds.stream().collect(Collectors.toMap(PhotovoltaicInfo::getInverter, Function.identity()));
|
|
Map<String, PhotovoltaicInfo> bzcldMap = bzclds.stream().collect(Collectors.toMap(PhotovoltaicInfo::getInverter, Function.identity()));
|
|
|
|
|
|
- String fs = config.getFilePathPrepare() + "gf\\";
|
|
|
|
|
|
+ String fs = config.getGfDataPath();
|
|
Map<String, List<PhotovoltaicInfo>> stringListMap = new HashMap<>();
|
|
Map<String, List<PhotovoltaicInfo>> stringListMap = new HashMap<>();
|
|
for (String s : fileList) {
|
|
for (String s : fileList) {
|
|
//读取一个文件
|
|
//读取一个文件
|
|
List<PhotovoltaicInfo> infos = file2Info(fs + s, true);
|
|
List<PhotovoltaicInfo> infos = file2Info(fs + s, true);
|
|
List<PhotovoltaicInfo> theoryInfos;
|
|
List<PhotovoltaicInfo> theoryInfos;
|
|
- if (s.contains("HZJ_GDC") || s.contains("AK_GDC")) {
|
|
|
|
|
|
+
|
|
|
|
+ boolean b = false;
|
|
|
|
+ String[] split = gf3xjscz.split(",");
|
|
|
|
+ for (String s1 : split) {
|
|
|
|
+ if (s.contains(s1)) b = true;
|
|
|
|
+ }
|
|
|
|
+ if (b) {
|
|
theoryInfos = CurrentVoltageCalc.CalcTheoryPowerHZJ(infos, bzcldMap);
|
|
theoryInfos = CurrentVoltageCalc.CalcTheoryPowerHZJ(infos, bzcldMap);
|
|
} else {
|
|
} else {
|
|
theoryInfos = CurrentVoltageCalc.CalcTheoryPower(infos, bzcldMap);
|
|
theoryInfos = CurrentVoltageCalc.CalcTheoryPower(infos, bzcldMap);
|
|
}
|
|
}
|
|
|
|
+
|
|
//按逆变器聚合数据
|
|
//按逆变器聚合数据
|
|
if (stringListMap.containsKey(theoryInfos.get(0).getInverter())) {
|
|
if (stringListMap.containsKey(theoryInfos.get(0).getInverter())) {
|
|
stringListMap.get(theoryInfos.get(0).getInverter()).addAll(theoryInfos);
|
|
stringListMap.get(theoryInfos.get(0).getInverter()).addAll(theoryInfos);
|
|
@@ -198,7 +210,7 @@ public class IvPvCurveFittingService {
|
|
*/
|
|
*/
|
|
public Map<String, List<PhotovoltaicInfo>> mergeCalculat(List<String> fileList) {
|
|
public Map<String, List<PhotovoltaicInfo>> mergeCalculat(List<String> fileList) {
|
|
|
|
|
|
- String fs = config.getFilePathPrepare() + "gf\\";
|
|
|
|
|
|
+ String fs = config.getGfDataPath();
|
|
Map<String, List<PhotovoltaicInfo>> stringListMap = new HashMap<>();
|
|
Map<String, List<PhotovoltaicInfo>> stringListMap = new HashMap<>();
|
|
for (String s : fileList) {
|
|
for (String s : fileList) {
|
|
//读取一个文件
|
|
//读取一个文件
|
|
@@ -260,9 +272,8 @@ public class IvPvCurveFittingService {
|
|
}
|
|
}
|
|
|
|
|
|
//文件第一行
|
|
//文件第一行
|
|
- List<FixedVo> fixedVos = annotationTool.getFixedVoList(PhotovoltaicInfo.class);
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
- String columnName = fixedVos.stream().map(FixedVo::getDes).collect(Collectors.joining(","));
|
|
|
|
|
|
+ String columnName = getFixedVos().stream().map(FixedVo::getDes).collect(Collectors.joining(","));
|
|
sb.append(columnName).append("\n");
|
|
sb.append(columnName).append("\n");
|
|
for (PhotovoltaicInfo ptInfo : ptInfos) {
|
|
for (PhotovoltaicInfo ptInfo : ptInfos) {
|
|
sb.append(ptInfo.getStation()).append(",").append(ptInfo.getInverter()).append(",")
|
|
sb.append(ptInfo.getStation()).append(",").append(ptInfo.getInverter()).append(",")
|
|
@@ -275,7 +286,7 @@ public class IvPvCurveFittingService {
|
|
.append(",").append(ptInfo.getCI()).append(",").append(ptInfo.getCV())
|
|
.append(",").append(ptInfo.getCI()).append(",").append(ptInfo.getCV())
|
|
.append("\n");
|
|
.append("\n");
|
|
}
|
|
}
|
|
- String fileName = config.getFilePathPrepare() + "bzd\\标准点.csv";
|
|
|
|
|
|
+ String fileName = config.getFilePathPrepare() + "bzd" + File.separator + "标准点.csv";
|
|
File file = new File(fileName);
|
|
File file = new File(fileName);
|
|
file.delete();
|
|
file.delete();
|
|
FileUtil.writeFile(fileName, sb.toString());
|
|
FileUtil.writeFile(fileName, sb.toString());
|
|
@@ -284,10 +295,9 @@ public class IvPvCurveFittingService {
|
|
|
|
|
|
public List<TableTitle> getTheoryTitel() {
|
|
public List<TableTitle> getTheoryTitel() {
|
|
|
|
|
|
- List<FixedVo> fixedVos = annotationTool.getFixedVoList(PhotovoltaicInfo.class);
|
|
|
|
String[] ss = {"station", "datetime", "T", "S", "actualP"};
|
|
String[] ss = {"station", "datetime", "T", "S", "actualP"};
|
|
List<String> strings = Arrays.asList(ss);
|
|
List<String> strings = Arrays.asList(ss);
|
|
- List<TableTitle> collect = fixedVos.stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
|
|
|
|
|
|
+ List<TableTitle> collect = getFixedVos().stream().map(d -> new TableTitle(d.getName(), d.getDes())).collect(Collectors.toList());
|
|
collect = collect.stream().filter(c -> strings.contains(c.getKey())).collect(Collectors.toList());
|
|
collect = collect.stream().filter(c -> strings.contains(c.getKey())).collect(Collectors.toList());
|
|
TableTitle title = new TableTitle();
|
|
TableTitle title = new TableTitle();
|
|
title.setKey("ideaP");
|
|
title.setKey("ideaP");
|
|
@@ -305,7 +315,7 @@ public class IvPvCurveFittingService {
|
|
*/
|
|
*/
|
|
public List<PhotovoltaicInfo> calculatFitting(List<String> fileList) {
|
|
public List<PhotovoltaicInfo> calculatFitting(List<String> fileList) {
|
|
|
|
|
|
- String fs = config.getFilePathPrepare() + "gf\\";
|
|
|
|
|
|
+ String fs = config.getGfDataPath();
|
|
List<PhotovoltaicInfo> infoList = new ArrayList<>();
|
|
List<PhotovoltaicInfo> infoList = new ArrayList<>();
|
|
for (String s : fileList) {
|
|
for (String s : fileList) {
|
|
List<PhotovoltaicInfo> infos = file2Info(fs + s, true);
|
|
List<PhotovoltaicInfo> infos = file2Info(fs + s, true);
|
|
@@ -351,7 +361,7 @@ public class IvPvCurveFittingService {
|
|
public List<FjjxbVo> getPhotovoltaicPerformanceList(long startdate, long enddate) {
|
|
public List<FjjxbVo> getPhotovoltaicPerformanceList(long startdate, long enddate) {
|
|
int oneday = 24 * 60 * 60;
|
|
int oneday = 24 * 60 * 60;
|
|
|
|
|
|
- String bzcldPath = config.getFilePathPrepare() + "bzd\\标准点.csv";
|
|
|
|
|
|
+ String bzcldPath = config.getFilePathPrepare() + "bzd" + File.separator + "标准点.csv";
|
|
List<PhotovoltaicInfo> bzclds = file2Info(bzcldPath, true);
|
|
List<PhotovoltaicInfo> bzclds = file2Info(bzcldPath, true);
|
|
Map<String, PhotovoltaicInfo> bzcldMap = bzclds.stream().collect(Collectors.toMap(PhotovoltaicInfo::getInverter, Function.identity()));
|
|
Map<String, PhotovoltaicInfo> bzcldMap = bzclds.stream().collect(Collectors.toMap(PhotovoltaicInfo::getInverter, Function.identity()));
|
|
|
|
|
|
@@ -383,7 +393,7 @@ public class IvPvCurveFittingService {
|
|
//遍历逆变器
|
|
//遍历逆变器
|
|
for (List<PhotovoltaicInfo> data : datas) {
|
|
for (List<PhotovoltaicInfo> data : datas) {
|
|
|
|
|
|
- if ("HZJ_GDC".equals(stationid) || "AK_GDC".equals(stationid)) {
|
|
|
|
|
|
+ if (gf3xjscz.contains(stationid)) {
|
|
CurrentVoltageCalc.CalcTheoryPowerHZJ(data, bzcldMap);
|
|
CurrentVoltageCalc.CalcTheoryPowerHZJ(data, bzcldMap);
|
|
} else {
|
|
} else {
|
|
CurrentVoltageCalc.CalcTheoryPower(data, bzcldMap);
|
|
CurrentVoltageCalc.CalcTheoryPower(data, bzcldMap);
|
|
@@ -443,7 +453,7 @@ public class IvPvCurveFittingService {
|
|
List<PhotovoltaicInfo> infos = new ArrayList<>();
|
|
List<PhotovoltaicInfo> infos = new ArrayList<>();
|
|
|
|
|
|
List<TsDoubleData> bdyDatas = null, cdyDatas = null, bdlDatas = null, cdlDatas = null;
|
|
List<TsDoubleData> bdyDatas = null, cdyDatas = null, bdlDatas = null, cdlDatas = null;
|
|
- if ("HZJ_GDC".equals(stationid) || "AK_GDC".equals(stationid)) {
|
|
|
|
|
|
+ if (gf3xjscz.contains(stationid)) {
|
|
//电网B相电压
|
|
//电网B相电压
|
|
bdyDatas = adpClient.getHistorySnap(bdypoints.get(wtid), start, end, interval);
|
|
bdyDatas = adpClient.getHistorySnap(bdypoints.get(wtid), start, end, interval);
|
|
//电网C相电压
|
|
//电网C相电压
|
|
@@ -464,7 +474,7 @@ public class IvPvCurveFittingService {
|
|
|
|
|
|
info.setT(double3Decimal(zjwdDatas.get(j).getDoubleValue()));
|
|
info.setT(double3Decimal(zjwdDatas.get(j).getDoubleValue()));
|
|
info.setS(double3Decimal(zfsDatas.get(j).getDoubleValue(), false));
|
|
info.setS(double3Decimal(zfsDatas.get(j).getDoubleValue(), false));
|
|
- if ("HZJ_GDC".equals(stationid) || "AK_GDC".equals(stationid)) {
|
|
|
|
|
|
+ if (gf3xjscz.contains(stationid)) {
|
|
info.setAI(double3Decimal(adlDatas.get(j).getDoubleValue(), false));
|
|
info.setAI(double3Decimal(adlDatas.get(j).getDoubleValue(), false));
|
|
info.setBI(double3Decimal(bdlDatas.get(j).getDoubleValue(), false));
|
|
info.setBI(double3Decimal(bdlDatas.get(j).getDoubleValue(), false));
|
|
info.setCI(double3Decimal(cdlDatas.get(j).getDoubleValue(), false));
|
|
info.setCI(double3Decimal(cdlDatas.get(j).getDoubleValue(), false));
|
|
@@ -502,7 +512,8 @@ public class IvPvCurveFittingService {
|
|
* 逆变器,测点
|
|
* 逆变器,测点
|
|
*/
|
|
*/
|
|
private Map<String, String> getPoints(String stationid, String key) {
|
|
private Map<String, String> getPoints(String stationid, String key) {
|
|
-
|
|
|
|
|
|
+ //获取unifromcode
|
|
|
|
+ getFixedVos();
|
|
switch (key) {
|
|
switch (key) {
|
|
case "zgl":
|
|
case "zgl":
|
|
//总功率
|
|
//总功率
|
|
@@ -514,30 +525,30 @@ public class IvPvCurveFittingService {
|
|
adyPoints = windPointService.getPoints(stationid, null, "AIG063");
|
|
adyPoints = windPointService.getPoints(stationid, null, "AIG063");
|
|
} else {
|
|
} else {
|
|
//电网A相电压
|
|
//电网A相电压
|
|
- adyPoints = windPointService.getPoints(stationid, null, "AIG061");
|
|
|
|
|
|
+ adyPoints = windPointService.getPoints(stationid, null, uniforcodes.get("A相电压"));
|
|
}
|
|
}
|
|
return adyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return adyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
case "bdy":
|
|
case "bdy":
|
|
- List<Windturbinetestingpointai2> bdyPoints = windPointService.getPoints(stationid, null, "AIG061A");
|
|
|
|
|
|
+ List<Windturbinetestingpointai2> bdyPoints = windPointService.getPoints(stationid, null, uniforcodes.get("B相电压"));
|
|
return bdyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return bdyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
case "cdy":
|
|
case "cdy":
|
|
- List<Windturbinetestingpointai2> cdyPoints = windPointService.getPoints(stationid, null, "AIG065");
|
|
|
|
|
|
+ List<Windturbinetestingpointai2> cdyPoints = windPointService.getPoints(stationid, null, uniforcodes.get("C相电压"));
|
|
return cdyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return cdyPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
case "adl":
|
|
case "adl":
|
|
- List<Windturbinetestingpointai2> adlPoints = windPointService.getPoints(stationid, null, "AIG060");
|
|
|
|
|
|
+ List<Windturbinetestingpointai2> adlPoints = windPointService.getPoints(stationid, null, uniforcodes.get("A相电流"));
|
|
return adlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return adlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
case "bdl":
|
|
case "bdl":
|
|
- List<Windturbinetestingpointai2> bdlPoints = windPointService.getPoints(stationid, null, "AIG062");
|
|
|
|
|
|
+ List<Windturbinetestingpointai2> bdlPoints = windPointService.getPoints(stationid, null, uniforcodes.get("B相电流"));
|
|
return bdlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return bdlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
case "cdl":
|
|
case "cdl":
|
|
- List<Windturbinetestingpointai2> cdlPoints = windPointService.getPoints(stationid, null, "AIG064");
|
|
|
|
|
|
+ List<Windturbinetestingpointai2> cdlPoints = windPointService.getPoints(stationid, null, uniforcodes.get("C相电流"));
|
|
return cdlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
return cdlPoints.stream().collect(Collectors.toMap(Windturbinetestingpointai2::getWindturbineid, Windturbinetestingpointai2::getCode));
|
|
}
|
|
}
|
|
return new HashMap<>();
|
|
return new HashMap<>();
|
|
}
|
|
}
|
|
|
|
|
|
public int deleteFiles(List<String> fileList) {
|
|
public int deleteFiles(List<String> fileList) {
|
|
- String fs = config.getFilePathPrepare() + "gf\\";
|
|
|
|
|
|
+ String fs = config.getGfDataPath();
|
|
List<PhotovoltaicInfo> infoList = new ArrayList<>();
|
|
List<PhotovoltaicInfo> infoList = new ArrayList<>();
|
|
int count = 0;
|
|
int count = 0;
|
|
for (String s : fileList) {
|
|
for (String s : fileList) {
|
|
@@ -549,7 +560,7 @@ public class IvPvCurveFittingService {
|
|
|
|
|
|
public void downFiles(List<String> strings, HttpServletResponse response) {
|
|
public void downFiles(List<String> strings, HttpServletResponse response) {
|
|
List<File> files = path2File(strings);
|
|
List<File> files = path2File(strings);
|
|
- String path = config.getFilePathPrepare() + "zip\\" + System.currentTimeMillis() + ".zip";
|
|
|
|
|
|
+ String path = config.getFilePathPrepare() + "zip" + File.separator + System.currentTimeMillis() + ".zip";
|
|
String s = FileUtil.zipFiles(files, new File(path));
|
|
String s = FileUtil.zipFiles(files, new File(path));
|
|
FileUtil.download(s, response);
|
|
FileUtil.download(s, response);
|
|
}
|
|
}
|
|
@@ -557,8 +568,21 @@ public class IvPvCurveFittingService {
|
|
private List<File> path2File(List<String> strings) {
|
|
private List<File> path2File(List<String> strings) {
|
|
List<File> files = new ArrayList<>();
|
|
List<File> files = new ArrayList<>();
|
|
for (String string : strings) {
|
|
for (String string : strings) {
|
|
- files.add(new File(config.getFilePathPrepare() + "gf\\" + string));
|
|
|
|
|
|
+ files.add(new File(config.getGfDataPath() + string));
|
|
}
|
|
}
|
|
return files;
|
|
return files;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public List<FixedVo> getFixedVos() {
|
|
|
|
+ if (fixedVos == null) {
|
|
|
|
+ fixedVos = annotationTool.getFixedVoList(PhotovoltaicInfo.class);
|
|
|
|
+ uniforcodes = fixedVos.stream().filter(fv -> fv.getUniformCode() != null).collect(Collectors.toMap(FixedVo::getDes, FixedVo::getUniformCode));
|
|
|
|
+ }
|
|
|
|
+ return fixedVos;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Map<String, String> getUniforcodes() {
|
|
|
|
+ getFixedVos();
|
|
|
|
+ return uniforcodes;
|
|
|
|
+ }
|
|
}
|
|
}
|