AverageAndGeneratingService.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. package com.gyee.generation.service;
  2. import com.gyee.common.contant.Contant;
  3. import com.gyee.common.model.PointData;
  4. import com.gyee.common.util.DateUtils;
  5. import com.gyee.generation.init.CacheContext;
  6. import com.gyee.generation.model.auto.*;
  7. import com.gyee.generation.util.realtimesource.IEdosUtil;
  8. import org.springframework.beans.factory.annotation.Value;
  9. import org.springframework.stereotype.Service;
  10. import javax.annotation.Resource;
  11. import java.util.*;
  12. /**
  13. * @ClassName : AverageAndGeneratingService
  14. * @Author : xieshengjie
  15. * @Date: 2022/3/22 10:42
  16. * @Description : 平均风速,平均功率,SCADA发电量
  17. */
  18. @Service
  19. public class AverageAndGeneratingService {
  20. private Date samedayZero;
  21. private Date monthFirstZero;
  22. private Date yearFirstZero;
  23. private Date currentDate;
  24. private List<Windpowerstation> wpls;
  25. private Map<String, List<Project>> wppromap;
  26. private Map<String, List<Line>> prolinemap;
  27. private Map<String, List<Windturbine>> linewtmap;
  28. private Date tomorrow;
  29. private List<Windturbine> wtls;
  30. private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
  31. private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
  32. private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
  33. private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
  34. @Resource
  35. private IEdosUtil edosUtil;
  36. @Value("${typeOfElectric.direct}")
  37. private String direct;
  38. private void init(){
  39. samedayZero = DateUtils.getSamedayZero();
  40. monthFirstZero = DateUtils.getMonthFirstZero();
  41. yearFirstZero = DateUtils.getYearFirstZero();
  42. currentDate = DateUtils.getCurrentDate();
  43. wpls = CacheContext.wpls;
  44. wtls = CacheContext.wtls;
  45. wppromap = CacheContext.wppromap;
  46. prolinemap = CacheContext.prolinemap;
  47. wppointmap = CacheContext.wppointmap;
  48. linepointmap = CacheContext.linepointmap;
  49. propointmap = CacheContext.propointmap;
  50. wtpAimap = CacheContext.wtpAimap;
  51. linewtmap = CacheContext.linewtmap;
  52. tomorrow = DateUtils.addDays(samedayZero,1);
  53. }
  54. /**
  55. * 保存最优功率,平均风速,平均功率,scada发电量,节能减排实时计算点
  56. * @throws Exception
  57. */
  58. public void saveAvespeedAndAvepowerAndScada() throws Exception {
  59. init();
  60. List<PointData> resultList = new ArrayList<>();
  61. String monthbenchPoints = Contant.monthbenchPoints;
  62. wpls.stream().forEach(wp->{
  63. List<Project> projects = wppromap.get(wp.getId());
  64. Map<String, Windpowerstationpointnew> wppointnewmap = wppointmap.get(wp.getId());
  65. Windpowerstationpointnew wpzyglpointnew = wppointnewmap.get(Contant.ZZYGL);
  66. Windpowerstationpointnew wppointnew = wppointnewmap.get(Contant.RPJFS);
  67. Windpowerstationpointnew ywppointnew = wppointnewmap.get(Contant.YPJFS);
  68. Windpowerstationpointnew nwppointnew = wppointnewmap.get(Contant.NPJFS);
  69. Windpowerstationpointnew powerwppointnew = wppointnewmap.get(Contant.RPJGL);
  70. Windpowerstationpointnew ypowerwppointnew = wppointnewmap.get(Contant.YPJGL);
  71. Windpowerstationpointnew npowerwppointnew = wppointnewmap.get(Contant.NPJGL);
  72. Windpowerstationpointnew fdlwppointnew = wppointnewmap.get(Contant.RFDL);
  73. Windpowerstationpointnew yfdlwppointnew = wppointnewmap.get(Contant.YFDL);
  74. Windpowerstationpointnew nfdlwppointnew = wppointnewmap.get(Contant.NFDL);
  75. Windpowerstationpointnew fnlylwppointnew = wppointnewmap.get(Contant.FNLYL);
  76. Windpowerstationpointnew jpeyhlwppointnew = wppointnewmap.get(Contant.JPEYHL);
  77. Windpowerstationpointnew jpeyhtwppointnew = wppointnewmap.get(Contant.JPEYHT);
  78. Windpowerstationpointnew jybmwppointnew = wppointnewmap.get(Contant.JYBM);
  79. Windpowerstationpointnew jyswppointnew = wppointnewmap.get(Contant.JYS);
  80. List<PointData> projectavespeedList = new ArrayList<>();
  81. List<PointData> yprojectavespeedList = new ArrayList<>();
  82. List<PointData> nprojectavespeedList = new ArrayList<>();
  83. List<PointData> projectzyglList = new ArrayList<>();
  84. List<PointData> projectavepowerList = new ArrayList<>();
  85. List<PointData> yprojectavepowerList = new ArrayList<>();
  86. List<PointData> nprojectavepowerList = new ArrayList<>();
  87. List<PointData> projectfdlList = new ArrayList<>();
  88. List<PointData> projectyfdlList = new ArrayList<>();
  89. List<PointData> projectnfdlList = new ArrayList<>();
  90. projects.stream().forEach(project -> {
  91. List<Line> lines = prolinemap.get(project.getId());
  92. Map<String, Windpowerstationpointnew> projectpointnewmap = propointmap.get(project.getId());
  93. Windpowerstationpointnew projectzyglpointnew = projectpointnewmap.get(Contant.ZZYGL);
  94. Windpowerstationpointnew projectpointnew = projectpointnewmap.get(Contant.RPJFS);
  95. Windpowerstationpointnew yprojectpointnew = projectpointnewmap.get(Contant.YPJFS);
  96. Windpowerstationpointnew nprojectpointnew = projectpointnewmap.get(Contant.NPJFS);
  97. Windpowerstationpointnew powerprojectpointnew = projectpointnewmap.get(Contant.RPJGL);
  98. Windpowerstationpointnew ypowerprojectpointnew = projectpointnewmap.get(Contant.YPJGL);
  99. Windpowerstationpointnew npowerprojectpointnew = projectpointnewmap.get(Contant.NPJGL);
  100. Windpowerstationpointnew fdlprojectpointnew = projectpointnewmap.get(Contant.RFDL);
  101. Windpowerstationpointnew yfdlprojectpointnew = projectpointnewmap.get(Contant.YFDL);
  102. Windpowerstationpointnew nfdlprojectpointnew = projectpointnewmap.get(Contant.NFDL);
  103. Windpowerstationpointnew fnlylprojectpointnew = projectpointnewmap.get(Contant.FNLYL);
  104. Windpowerstationpointnew jpeyhlprojectpointnew = projectpointnewmap.get(Contant.JPEYHL);
  105. Windpowerstationpointnew jpeyhtprojectpointnew = projectpointnewmap.get(Contant.JPEYHT);
  106. Windpowerstationpointnew jybmprojectpointnew = projectpointnewmap.get(Contant.JYBM);
  107. Windpowerstationpointnew jysprojectpointnew = projectpointnewmap.get(Contant.JYS);
  108. List<PointData> lineavespeedList = new ArrayList<>();
  109. List<PointData> ylineavespeedList = new ArrayList<>();
  110. List<PointData> nlineavespeedList = new ArrayList<>();
  111. List<PointData> lineavepowerList = new ArrayList<>();
  112. List<PointData> linezyglpowerList = new ArrayList<>();
  113. List<PointData> ylineavepowerList = new ArrayList<>();
  114. List<PointData> nlineavepowerList = new ArrayList<>();
  115. List<PointData> linefdlList = new ArrayList<>();
  116. List<PointData> ylinefdlList = new ArrayList<>();
  117. List<PointData> nlinefdlList = new ArrayList<>();
  118. lines.stream().forEach(line -> {
  119. List<Windturbine> windturbines = linewtmap.get(line.getId());
  120. Map<String, Windpowerstationpointnew> linepointnewmap = linepointmap.get(line.getId());
  121. Windpowerstationpointnew linezyglpointnew = linepointnewmap.get(Contant.ZZYGL);
  122. Windpowerstationpointnew linepointnew = linepointnewmap.get(Contant.RPJFS);
  123. Windpowerstationpointnew ylinepointnew = linepointnewmap.get(Contant.YPJFS);
  124. Windpowerstationpointnew nlinepointnew = linepointnewmap.get(Contant.NPJFS);
  125. Windpowerstationpointnew linepowerpointnew = linepointnewmap.get(Contant.RPJGL);
  126. Windpowerstationpointnew ylinepowerpointnew = linepointnewmap.get(Contant.YPJGL);
  127. Windpowerstationpointnew nlinepowerpointnew = linepointnewmap.get(Contant.NPJGL);
  128. Windpowerstationpointnew linefdlpointnew = linepointnewmap.get(Contant.RFDL);
  129. Windpowerstationpointnew ylinefdlpointnew = linepointnewmap.get(Contant.YFDL);
  130. Windpowerstationpointnew nlinefdlpointnew = linepointnewmap.get(Contant.NFDL);
  131. Windpowerstationpointnew linefnlylpointnew = linepointnewmap.get(Contant.FNLYL);
  132. Windpowerstationpointnew jpeyhlpointnew = linepointnewmap.get(Contant.JPEYHL);
  133. Windpowerstationpointnew jpeyhtpointnew = linepointnewmap.get(Contant.JPEYHT);
  134. Windpowerstationpointnew jybmpointnew = linepointnewmap.get(Contant.JYBM);
  135. Windpowerstationpointnew jyspointnew = linepointnewmap.get(Contant.JYS);
  136. List<PointData> wtzygldList = new ArrayList<>();
  137. List<PointData> wtavespeedList = new ArrayList<>();
  138. List<PointData> ywtavespeedList = new ArrayList<>();
  139. List<PointData> nwtavespeedList = new ArrayList<>();
  140. List<PointData> wtavepowerList = new ArrayList<>();
  141. List<PointData> ywtavepowerList = new ArrayList<>();
  142. List<PointData> nwtavepowerList = new ArrayList<>();
  143. List<PointData> rfdlList = new ArrayList<>();
  144. List<PointData> yfdlList = new ArrayList<>();
  145. List<PointData> nfdlList = new ArrayList<>();
  146. windturbines.stream().forEach(wt->{
  147. Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
  148. Windturbinetestingpointnew zyglPoint = windturbinetestingpointnewMap.get(Contant.ZZYGL);
  149. Windturbinetestingpointnew aveSpeedPoint = windturbinetestingpointnewMap.get(Contant.RPJFS);
  150. Windturbinetestingpointnew monthAveSpeedPoint = windturbinetestingpointnewMap.get(Contant.YPJFS);
  151. Windturbinetestingpointnew yearAveSpeedPoint = windturbinetestingpointnewMap.get(Contant.NPJFS);
  152. Windturbinetestingpointnew fjssfs = windturbinetestingpointnewMap.get(Contant.AI022);
  153. Windturbinetestingpointnew avePowerPoint = windturbinetestingpointnewMap.get(Contant.RPJGL);
  154. Windturbinetestingpointnew yavePowerPoint = windturbinetestingpointnewMap.get(Contant.YPJGL);
  155. Windturbinetestingpointnew navePowerPoint = windturbinetestingpointnewMap.get(Contant.NPJGL);
  156. Windturbinetestingpointnew fjssgl = windturbinetestingpointnewMap.get(Contant.AI130);
  157. Windturbinetestingpointnew ai064 = windturbinetestingpointnewMap.get(Contant.AI064);
  158. Windturbinetestingpointnew fjfdl = windturbinetestingpointnewMap.get(Contant.RFDL);
  159. Windturbinetestingpointnew fjyfdl = windturbinetestingpointnewMap.get(Contant.YFDL);
  160. Windturbinetestingpointnew fjnfdl = windturbinetestingpointnewMap.get(Contant.NFDL);
  161. Windturbinetestingpointnew ai138 = windturbinetestingpointnewMap.get(Contant.AI138);
  162. Windturbinetestingpointnew ai139 = windturbinetestingpointnewMap.get(Contant.AI139);
  163. try {
  164. //算发电量
  165. Double rfdl = 0.0;
  166. Double yfdl = 0.0;
  167. Double nfdl = 0.0;
  168. if (direct.contains(wt.getProjectid())){
  169. rfdl = edosUtil.getSectionData(ai064,tomorrow.getTime()).getPointValueInDouble();
  170. yfdl = edosUtil.getSectionData(ai138,tomorrow.getTime()).getPointValueInDouble();
  171. nfdl = edosUtil.getSectionData(ai139,tomorrow.getTime()).getPointValueInDouble();
  172. }else{
  173. Double currentValue = 0.0;
  174. Double samedayValue = 0.0;
  175. Double monthFirstValue = 0.0;
  176. Double yearFirstValue = 0.0;
  177. PointData realData = edosUtil.getSectionData(ai064,tomorrow.getTime());
  178. currentValue = realData.getPointValueInDouble();
  179. samedayValue = edosUtil.getSectionData(ai064,samedayZero.getTime()).getPointValueInDouble();
  180. monthFirstValue = edosUtil.getSectionData(ai064,monthFirstZero.getTime()).getPointValueInDouble();
  181. yearFirstValue = edosUtil.getSectionData(ai064,yearFirstZero.getTime()).getPointValueInDouble();
  182. rfdl = currentValue - samedayValue;
  183. yfdl = currentValue - monthFirstValue;
  184. nfdl = currentValue - yearFirstValue;
  185. }
  186. PointData fdlpointData = createPointData(fjfdl, rfdl);
  187. rfdlList.add(fdlpointData);
  188. PointData yfdlpointData = createPointData(fjyfdl, yfdl);
  189. yfdlList.add(yfdlpointData);
  190. PointData nfdlpointData = createPointData(fjnfdl, nfdl);
  191. yfdlList.add(nfdlpointData);
  192. //算平均风速
  193. List<PointData> ssfsList = edosUtil.getHistStat(fjssfs, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  194. Optional<PointData> ssfsFirst = ssfsList.stream().findFirst();
  195. if (ssfsFirst.isPresent()){
  196. PointData pointData = ssfsFirst.get();
  197. double inDouble = pointData.getPointValueInDouble();
  198. createWtPointData(aveSpeedPoint, pointData, inDouble);
  199. wtavespeedList.add(pointData);
  200. }
  201. //算月平均风速
  202. List<PointData> yssfsList = edosUtil.getHistStat(fjssfs, monthFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  203. Optional<PointData> yssfsFirst = yssfsList.stream().findFirst();
  204. if (yssfsFirst.isPresent()){
  205. PointData pointData = yssfsFirst.get();
  206. double inDouble = pointData.getPointValueInDouble();
  207. createWtPointData(monthAveSpeedPoint, pointData, inDouble);
  208. ywtavespeedList.add(pointData);
  209. }
  210. //算年平均风速
  211. List<PointData> nssfsList = edosUtil.getHistStat(fjssfs, yearFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  212. Optional<PointData> nssfsFirst = nssfsList.stream().findFirst();
  213. if (nssfsFirst.isPresent()){
  214. PointData pointData = nssfsFirst.get();
  215. double inDouble = pointData.getPointValueInDouble();
  216. createWtPointData(yearAveSpeedPoint, pointData, inDouble);
  217. nwtavespeedList.add(pointData);
  218. }
  219. //算平均功率
  220. List<PointData> ssglList = edosUtil.getHistStat(fjssgl, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  221. Optional<PointData> ssglFirst = ssglList.stream().findFirst();
  222. if (ssglFirst.isPresent()){
  223. PointData pointData = ssglFirst.get();
  224. double inDouble = pointData.getPointValueInDouble();
  225. createWtPointData(avePowerPoint, pointData, inDouble);
  226. wtavepowerList.add(pointData);
  227. }
  228. //算最优功率
  229. List<PointData> zyglList = edosUtil.getHistStat(fjssgl, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 0);
  230. Optional<PointData> zyglFirst = zyglList.stream().findFirst();
  231. if (zyglFirst.isPresent()){
  232. PointData pointData = zyglFirst.get();
  233. double inDouble = pointData.getPointValueInDouble();
  234. createWtPointData(zyglPoint, pointData, inDouble);
  235. wtzygldList.add(pointData);
  236. }
  237. //算月平均功率
  238. List<PointData> yssglList = edosUtil.getHistStat(fjssgl, monthFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  239. Optional<PointData> yssglFirst = yssglList.stream().findFirst();
  240. if (yssglFirst.isPresent()){
  241. PointData pointData = yssglFirst.get();
  242. double inDouble = pointData.getPointValueInDouble();
  243. createWtPointData(yavePowerPoint, pointData, inDouble);
  244. ywtavepowerList.add(pointData);
  245. }
  246. //算年平均功率
  247. List<PointData> nssglList = edosUtil.getHistStat(fjssgl, yearFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
  248. Optional<PointData> nssglFirst = nssglList.stream().findFirst();
  249. if (nssglFirst.isPresent()){
  250. PointData pointData = nssglFirst.get();
  251. double inDouble = pointData.getPointValueInDouble();
  252. createWtPointData(navePowerPoint, pointData, inDouble);
  253. nwtavepowerList.add(pointData);
  254. }
  255. } catch (Exception e) {
  256. e.printStackTrace();
  257. }
  258. });
  259. resultList.addAll(wtavespeedList);
  260. resultList.addAll(ywtavespeedList);
  261. resultList.addAll(nwtavespeedList);
  262. resultList.addAll(wtavepowerList);
  263. resultList.addAll(wtzygldList);
  264. resultList.addAll(ywtavepowerList);
  265. resultList.addAll(nwtavepowerList);
  266. resultList.addAll(rfdlList);
  267. resultList.addAll(yfdlList);
  268. resultList.addAll(nfdlList);
  269. double linefdl = rfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  270. double lineyfdl = yfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  271. double linenfdl = nfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  272. PointData fdlpoint = createWpPointData(linefdlpointnew, linefdl);
  273. PointData yfdlpoint = createWpPointData(ylinefdlpointnew, lineyfdl);
  274. PointData nfdlpoint = createWpPointData(nlinefdlpointnew, linenfdl);
  275. linefdlList.add(fdlpoint);
  276. ylinefdlList.add(yfdlpoint);
  277. nlinefdlList.add(nfdlpoint);
  278. //算节能减排
  279. double jpeyhl = lineyfdl * 0.0059;
  280. double jpeyht = lineyfdl * 0.8568;
  281. double jybm = lineyfdl * 0.37;
  282. double jys = lineyfdl * 3.05;
  283. PointData jpeyhlpoint = createWpPointData(jpeyhlpointnew, jpeyhl);
  284. PointData jpeyhtpoint = createWpPointData(jpeyhtpointnew, jpeyht);
  285. PointData jybmpoint = createWpPointData(jybmpointnew, jybm);
  286. PointData jyspoint = createWpPointData(jyspointnew, jys);
  287. resultList.add(jpeyhlpoint);
  288. resultList.add(jpeyhtpoint);
  289. resultList.add(jybmpoint);
  290. resultList.add(jyspoint);
  291. //算风能利用率
  292. List<String> pointList = new ArrayList<>();
  293. double ssdl = 0;
  294. Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
  295. pointList.add(linepointnewmap.get(code).getCode());
  296. });
  297. try {
  298. List<PointData> ssdlList = edosUtil.getRealData(pointList);
  299. ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  300. } catch (Exception e) {
  301. e.printStackTrace();
  302. }
  303. double fnlyl = (ssdl+lineyfdl)!=0?lineyfdl/(ssdl+lineyfdl)*100:0;
  304. PointData fnlylpoint = createWpPointData(linefnlylpointnew, fnlyl);
  305. resultList.add(fnlylpoint);
  306. OptionalDouble average = wtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  307. if (average.isPresent()){
  308. double linespeed = average.getAsDouble();
  309. PointData pointData = createWpPointData(linepointnew, linespeed);
  310. lineavespeedList.add(pointData);
  311. }
  312. OptionalDouble yaverage = ywtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  313. if (yaverage.isPresent()){
  314. double linespeed = yaverage.getAsDouble();
  315. PointData pointData = createWpPointData(ylinepointnew, linespeed);
  316. ylineavespeedList.add(pointData);
  317. }
  318. OptionalDouble naverage = nwtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  319. if (naverage.isPresent()){
  320. double linespeed = naverage.getAsDouble();
  321. PointData pointData = createWpPointData(nlinepointnew, linespeed);
  322. nlineavespeedList.add(pointData);
  323. }
  324. Double poweraverage = wtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  325. PointData powerpointData = createWpPointData(linepowerpointnew, poweraverage);
  326. lineavepowerList.add(powerpointData);
  327. Double zyglrage = wtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  328. PointData zyglpointData = createWpPointData(linezyglpointnew, zyglrage);
  329. linezyglpowerList.add(zyglpointData);
  330. Double ypoweraverage = ywtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  331. PointData ypowerpointData = createWpPointData(ylinepowerpointnew, ypoweraverage);
  332. ylineavepowerList.add(ypowerpointData);
  333. Double npoweraverage = nwtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  334. PointData npowerpointData = createWpPointData(nlinepowerpointnew, npoweraverage);
  335. nlineavepowerList.add(npowerpointData);
  336. });
  337. OptionalDouble average = lineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  338. OptionalDouble yaverage = ylineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  339. OptionalDouble naverage = nlineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  340. Double prorfdl = linefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  341. Double proyfdl = ylinefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  342. Double pronfdl = nlinefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  343. resultList.addAll(lineavespeedList);
  344. resultList.addAll(ylineavespeedList);
  345. resultList.addAll(nlineavespeedList);
  346. resultList.addAll(lineavepowerList);
  347. resultList.addAll(ylineavepowerList);
  348. resultList.addAll(nlineavepowerList);
  349. resultList.addAll(linefdlList);
  350. resultList.addAll(ylinefdlList);
  351. resultList.addAll(nlinefdlList);
  352. resultList.addAll(linezyglpowerList);
  353. //算节能减排
  354. double jpeyhl = proyfdl * 0.0059;
  355. double jpeyht = proyfdl * 0.8568;
  356. double jybm = proyfdl * 0.37;
  357. double jys = proyfdl * 3.05;
  358. PointData jpeyhlpoint = createWpPointData(jpeyhlprojectpointnew, jpeyhl);
  359. PointData jpeyhtpoint = createWpPointData(jpeyhtprojectpointnew, jpeyht);
  360. PointData jybmpoint = createWpPointData(jybmprojectpointnew, jybm);
  361. PointData jyspoint = createWpPointData(jysprojectpointnew, jys);
  362. resultList.add(jpeyhlpoint);
  363. resultList.add(jpeyhtpoint);
  364. resultList.add(jybmpoint);
  365. resultList.add(jyspoint);
  366. //算风能利用率
  367. List<String> pointList = new ArrayList<>();
  368. double ssdl = 0;
  369. Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
  370. pointList.add(projectpointnewmap.get(code).getCode());
  371. });
  372. try {
  373. List<PointData> ssdlList = edosUtil.getRealData(pointList);
  374. ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  375. } catch (Exception e) {
  376. e.printStackTrace();
  377. }
  378. double fnlyl = (ssdl+proyfdl)!=0?proyfdl/(ssdl+proyfdl)*100:0;
  379. PointData fnlylpoint = createWpPointData(fnlylprojectpointnew, fnlyl);
  380. resultList.add(fnlylpoint);
  381. PointData rfdlpointData = createWpPointData(fdlprojectpointnew, prorfdl);
  382. PointData yfdlpointData = createWpPointData(yfdlprojectpointnew, proyfdl);
  383. PointData nfdlpointData = createWpPointData(nfdlprojectpointnew, pronfdl);
  384. projectfdlList.add(rfdlpointData);
  385. projectyfdlList.add(yfdlpointData);
  386. projectnfdlList.add(nfdlpointData);
  387. if (average.isPresent()){
  388. double projectspeed = average.getAsDouble();
  389. PointData pointData = createWpPointData(projectpointnew, projectspeed);
  390. projectavespeedList.add(pointData);
  391. }
  392. if (yaverage.isPresent()){
  393. double projectspeed = yaverage.getAsDouble();
  394. PointData pointData = createWpPointData(yprojectpointnew, projectspeed);
  395. yprojectavespeedList.add(pointData);
  396. }
  397. if (naverage.isPresent()){
  398. double projectspeed = naverage.getAsDouble();
  399. PointData pointData = createWpPointData(nprojectpointnew, projectspeed);
  400. nprojectavespeedList.add(pointData);
  401. }
  402. Double zyglaverage = linezyglpowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  403. Double poweraverage = lineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  404. Double ypoweraverage = ylineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  405. Double npoweraverage = nlineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  406. PointData zyglpointData = createWpPointData(projectzyglpointnew, zyglaverage);
  407. projectzyglList.add(zyglpointData);
  408. PointData powerpointData = createWpPointData(powerprojectpointnew, poweraverage);
  409. projectavepowerList.add(powerpointData);
  410. PointData ypowerpointData = createWpPointData(ypowerprojectpointnew, ypoweraverage);
  411. yprojectavepowerList.add(ypowerpointData);
  412. PointData npowerpointData = createWpPointData(npowerprojectpointnew, npoweraverage);
  413. nprojectavepowerList.add(npowerpointData);
  414. });
  415. resultList.addAll(projectfdlList);
  416. resultList.addAll(projectyfdlList);
  417. resultList.addAll(projectnfdlList);
  418. double fcrfdl = projectfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  419. PointData fdlpointData = createWpPointData(fdlwppointnew, fcrfdl);
  420. resultList.add(fdlpointData);
  421. double fcyfdl = projectyfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  422. PointData yfdlpointData = createWpPointData(yfdlwppointnew, fcyfdl);
  423. resultList.add(yfdlpointData);
  424. //算节能减排
  425. double jpeyhl = fcyfdl * 0.0059;
  426. double jpeyht = fcyfdl * 0.8568;
  427. double jybm = fcyfdl * 0.37;
  428. double jys = fcyfdl * 3.05;
  429. PointData jpeyhlpoint = createWpPointData(jpeyhlwppointnew, jpeyhl);
  430. PointData jpeyhtpoint = createWpPointData(jpeyhtwppointnew, jpeyht);
  431. PointData jybmpoint = createWpPointData(jybmwppointnew, jybm);
  432. PointData jyspoint = createWpPointData(jyswppointnew, jys);
  433. resultList.add(jpeyhlpoint);
  434. resultList.add(jpeyhtpoint);
  435. resultList.add(jybmpoint);
  436. resultList.add(jyspoint);
  437. //算风能利用率
  438. List<String> pointList = new ArrayList<>();
  439. double ssdl = 0;
  440. Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
  441. pointList.add(wppointnewmap.get(code).getCode());
  442. });
  443. try {
  444. List<PointData> ssdlList = edosUtil.getRealData(pointList);
  445. ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  446. } catch (Exception e) {
  447. e.printStackTrace();
  448. }
  449. double fnlyl = (ssdl+fcyfdl)!=0?fcyfdl/(ssdl+fcyfdl)*100:0;
  450. PointData fnlylpoint = createWpPointData(fnlylwppointnew, fnlyl);
  451. resultList.add(fnlylpoint);
  452. double fcnfdl = projectnfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  453. PointData nfdlpointData = createWpPointData(nfdlwppointnew, fcnfdl);
  454. resultList.add(nfdlpointData);
  455. OptionalDouble average = projectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  456. resultList.addAll(projectavespeedList);
  457. if (average.isPresent()){
  458. double wpspeed = average.getAsDouble();
  459. PointData pointData = createWpPointData(wppointnew, wpspeed);
  460. resultList.add(pointData);
  461. }
  462. OptionalDouble yaverage = yprojectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  463. resultList.addAll(yprojectavespeedList);
  464. if (yaverage.isPresent()){
  465. double wpspeed = yaverage.getAsDouble();
  466. PointData pointData = createWpPointData(ywppointnew, wpspeed);
  467. resultList.add(pointData);
  468. }
  469. OptionalDouble naverage = nprojectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
  470. resultList.addAll(nprojectavespeedList);
  471. if (naverage.isPresent()){
  472. double wpspeed = naverage.getAsDouble();
  473. PointData pointData = createWpPointData(nwppointnew, wpspeed);
  474. resultList.add(pointData);
  475. }
  476. Double poweraverage = projectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  477. resultList.addAll(projectavepowerList);
  478. PointData powerpointData = createWpPointData(powerwppointnew, poweraverage);
  479. resultList.add(powerpointData);
  480. Double zyglaverage = projectzyglList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  481. resultList.addAll(projectzyglList);
  482. PointData zyglpointData = createWpPointData(wpzyglpointnew, zyglaverage);
  483. resultList.add(zyglpointData);
  484. Double ypoweraverage = yprojectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  485. resultList.addAll(yprojectavepowerList);
  486. PointData ypowerpointData = createWpPointData(ypowerwppointnew, ypoweraverage);
  487. resultList.add(ypowerpointData);
  488. Double npoweraverage = nprojectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
  489. resultList.addAll(nprojectavepowerList);
  490. PointData npowerpointData = createWpPointData(npowerwppointnew, npoweraverage);
  491. resultList.add(npowerpointData);
  492. });
  493. edosUtil.sendMultiPoint(resultList);
  494. }
  495. private PointData createPointData(Windturbinetestingpointnew fjfdl, Double rfdl) {
  496. PointData pointData = new PointData();
  497. pointData.setEdnaId(fjfdl.getCode());
  498. pointData.setPointName(fjfdl.getName());
  499. pointData.setPointTime(currentDate.getTime());
  500. pointData.setPointValueInDouble(rfdl);
  501. pointData.setPointValue(String.valueOf(rfdl));
  502. return pointData;
  503. }
  504. private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
  505. PointData pointData = new PointData();
  506. pointData.setEdnaId(linepointnew.getCode());
  507. pointData.setPointTime(currentDate.getTime());
  508. pointData.setPointName(linepointnew.getName());
  509. pointData.setPointValue(String.valueOf(linespeed));
  510. pointData.setPointValueInDouble(linespeed);
  511. return pointData;
  512. }
  513. private void createWtPointData(Windturbinetestingpointnew aveSpeedPoint, PointData pointData, double inDouble) {
  514. pointData.setEdnaId(aveSpeedPoint.getCode());
  515. pointData.setPointName(aveSpeedPoint.getName());
  516. pointData.setPointValueInDouble(inDouble);
  517. pointData.setPointValue(String.valueOf(inDouble));
  518. pointData.setPointTime(currentDate.getTime());
  519. }
  520. }