FiveLossesService.java 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104
  1. package com.gyee.generation.service;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
  4. import com.gyee.common.contant.Contant;
  5. import com.gyee.common.model.PointData;
  6. import com.gyee.common.model.StringUtils;
  7. import com.gyee.common.util.CommonUtils;
  8. import com.gyee.common.util.DateUtils;
  9. import com.gyee.generation.init.CacheContext;
  10. import com.gyee.generation.model.auto.*;
  11. import com.gyee.generation.service.auto.IShutdowneventService;
  12. import com.gyee.generation.util.realtimesource.IEdosUtil;
  13. import org.springframework.stereotype.Service;
  14. import javax.annotation.Resource;
  15. import java.util.*;
  16. import java.util.concurrent.atomic.AtomicReference;
  17. import java.util.stream.Collectors;
  18. /**
  19. * @ClassName : FiveLossesService
  20. * @Author : xieshengjie
  21. * @Date: 2022/5/2 16:13
  22. * @Description : 五项损失,欠发状态,欠发发电量
  23. */
  24. @Service
  25. public class FiveLossesService {
  26. @Resource
  27. private IEdosUtil edosUtil;
  28. private List<Windturbine> wtls;
  29. private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
  30. private Date samedayZero;
  31. private Date currentDate;
  32. private Date tomorrow;
  33. private List<Windpowerstation> wpls;
  34. private Map<String, List<Project>> wppromap;
  35. private Map<String, List<Line>> prolinemap;
  36. private Map<String, List<Windturbine>> linewtmap;
  37. private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
  38. private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
  39. private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
  40. @Resource
  41. private IShutdowneventService shutdowneventService;
  42. private void init(){
  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. samedayZero = DateUtils.getSamedayZero();
  53. currentDate = DateUtils.getCurrentDate();
  54. tomorrow = DateUtils.addDays(samedayZero,1);
  55. }
  56. public void lossesReal() throws Exception {
  57. init();
  58. wtDaylossesReal();
  59. wtMonthYearlossesReal();
  60. wpDaylossesReal();
  61. }
  62. /**
  63. * 存储shutdownevent
  64. */
  65. public void saveShutdownevent(){
  66. init();
  67. List<PointData> resultList = new ArrayList<>();
  68. QueryWrapper<Shutdownevent> qw = new QueryWrapper<>();
  69. qw.isNull("starttime");
  70. qw.isNotNull("stoptime");
  71. qw.in("windpowerstationid",wpls.stream().map(wp->wp.getId()).collect(Collectors.toList()));
  72. //查出有故障但没恢复的事件
  73. List<Shutdownevent> shutdownevents = shutdowneventService.list(qw);
  74. List<String> faultWinturbines = null;
  75. List<String> mainWinturbines = null;
  76. if (StringUtils.isNotEmpty(shutdownevents)){
  77. faultWinturbines = shutdownevents.stream().filter(i->i.getStatuscode()==2).map(s -> s.getWindturbineid()).collect(Collectors.toList());
  78. mainWinturbines = shutdownevents.stream().filter(i->i.getStatuscode()==4).map(s -> s.getWindturbineid()).collect(Collectors.toList());
  79. }
  80. List<String> finalFaultWinturbines = faultWinturbines;
  81. List<String> finalMainWinturbines = mainWinturbines;
  82. wtls.stream().forEach(wt->{
  83. Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
  84. Windturbinetestingpointnew ztmxPoint = windturbinetestingpointnewMap.get(Contant.ZTMX);
  85. Windturbinetestingpointnew bzglPoint = windturbinetestingpointnewMap.get(Contant.BZGL);
  86. Windturbinetestingpointnew zsglPoint = windturbinetestingpointnewMap.get(Contant.ZSGL);
  87. Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
  88. PointData sectionData = null;
  89. try {
  90. sectionData = edosUtil.getSectionData(ztmxPoint, tomorrow.getTime());
  91. } catch (Exception e) {
  92. e.printStackTrace();
  93. }
  94. double fjzt = sectionData.getPointValueInDouble();
  95. if (StringUtils.isNotEmpty(finalFaultWinturbines) && finalFaultWinturbines.contains(wt.getId())){ //此风机在之前故障未恢复列表
  96. if (fjzt!=6){
  97. //将时间存储到结束时间,算时间与电量
  98. Optional<Shutdownevent> first = shutdownevents.stream().filter(i -> i.getWindturbineid().equals(wt.getId())).findFirst();
  99. if (first.isPresent()){
  100. Shutdownevent shutdownevent = first.get();
  101. Date starttime = DateUtils.parseLongToDate(sectionData.getPointTime()*1000);
  102. shutdownevent.setStarttime(starttime);
  103. Date stoptime = shutdownevent.getStoptime();
  104. double hour = DateUtils.hoursDiff2(stoptime, starttime);
  105. shutdownevent.setStophours(hour);
  106. List<PointData> ztmxDatasSnap = null;
  107. List<PointData> bzglDatasSnap = null;
  108. List<PointData> zsglDatasSnap = null;
  109. List<PointData> powerDatasSnap = null;
  110. try {
  111. ztmxDatasSnap = edosUtil.getHistoryDatasSnap(ztmxPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  112. bzglDatasSnap = edosUtil.getHistoryDatasSnap(bzglPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  113. zsglDatasSnap = edosUtil.getHistoryDatasSnap(zsglPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  114. powerDatasSnap = edosUtil.getHistoryDatasSnap(powerPoint, stoptime.getTime() / 1000, starttime.getTime() / 1000, null, 60l);
  115. } catch (Exception e) {
  116. e.printStackTrace();
  117. }
  118. if (ztmxDatasSnap.size() == zsglDatasSnap.size()){
  119. //故障
  120. double gzss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 6.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRGZSSDL));
  121. shutdownevent.setLosspower(gzss);
  122. }
  123. shutdowneventService.saveOrUpdate(shutdownevent);
  124. }
  125. }
  126. if (fjzt==8){
  127. Shutdownevent shutdownevent = new Shutdownevent();
  128. shutdownevent.setId(CommonUtils.getUUID());
  129. shutdownevent.setWindpowerstationid(wt.getWindpowerstationid());
  130. shutdownevent.setWindturbineid(wt.getId());
  131. Date date = DateUtils.parseLongToDate(sectionData.getPointTime()*1000);
  132. shutdownevent.setStoptime(date);
  133. shutdownevent.setProjectid(wt.getProjectid());
  134. shutdownevent.setStatuscode(4);
  135. shutdowneventService.save(shutdownevent);
  136. }
  137. }
  138. else if (StringUtils.isNotEmpty(finalMainWinturbines) && finalMainWinturbines.contains(wt.getId())){ //此风机在之前故障未恢复列表
  139. if (fjzt!=8){
  140. //将时间存储到结束时间,算时间与电量
  141. Optional<Shutdownevent> first = shutdownevents.stream().filter(i -> i.getWindturbineid().equals(wt.getId())).findFirst();
  142. if (first.isPresent()){
  143. Shutdownevent shutdownevent = first.get();
  144. Date starttime = DateUtils.parseLongToDate(sectionData.getPointTime()*1000);
  145. shutdownevent.setStarttime(starttime);
  146. Date stoptime = shutdownevent.getStoptime();
  147. double hour = DateUtils.hoursDiff2(stoptime, starttime);
  148. shutdownevent.setStophours(hour);
  149. List<PointData> ztmxDatasSnap = null;
  150. List<PointData> bzglDatasSnap = null;
  151. List<PointData> zsglDatasSnap = null;
  152. List<PointData> powerDatasSnap = null;
  153. try {
  154. ztmxDatasSnap = edosUtil.getHistoryDatasSnap(ztmxPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  155. bzglDatasSnap = edosUtil.getHistoryDatasSnap(bzglPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  156. zsglDatasSnap = edosUtil.getHistoryDatasSnap(zsglPoint,stoptime.getTime()/1000,starttime.getTime()/1000,null,60l);
  157. powerDatasSnap = edosUtil.getHistoryDatasSnap(powerPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
  158. } catch (Exception e) {
  159. e.printStackTrace();
  160. }
  161. if (ztmxDatasSnap.size() == zsglDatasSnap.size()){
  162. //维护
  163. double jxss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 8.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRJXSSDL));
  164. shutdownevent.setLosspower(jxss);
  165. }
  166. shutdowneventService.saveOrUpdate(shutdownevent);
  167. }
  168. }
  169. if (fjzt==6){
  170. Shutdownevent shutdownevent = new Shutdownevent();
  171. shutdownevent.setId(CommonUtils.getUUID());
  172. shutdownevent.setWindpowerstationid(wt.getWindpowerstationid());
  173. shutdownevent.setWindturbineid(wt.getId());
  174. Date date = DateUtils.parseLongToDate(sectionData.getPointTime()*1000);
  175. shutdownevent.setStoptime(date);
  176. shutdownevent.setProjectid(wt.getProjectid());
  177. shutdownevent.setStatuscode(2);
  178. shutdowneventService.save(shutdownevent);
  179. }
  180. }
  181. else { //没有没结束的故障维护事件
  182. if (fjzt==6 || fjzt==8){
  183. Shutdownevent shutdownevent = new Shutdownevent();
  184. shutdownevent.setId(CommonUtils.getUUID());
  185. shutdownevent.setWindpowerstationid(wt.getWindpowerstationid());
  186. shutdownevent.setWindturbineid(wt.getId());
  187. Date date = DateUtils.parseLongToDate(sectionData.getPointTime()*1000);
  188. shutdownevent.setStoptime(date);
  189. shutdownevent.setProjectid(wt.getProjectid());
  190. if (fjzt == 6){
  191. shutdownevent.setStatuscode(2);
  192. }else {
  193. shutdownevent.setStatuscode(4);
  194. }
  195. shutdowneventService.save(shutdownevent);
  196. }
  197. }
  198. });
  199. }
  200. /**
  201. * 场站五损,欠发电量
  202. */
  203. private void wpDaylossesReal() throws Exception {
  204. List<PointData> resultList = new ArrayList<>();
  205. wpls.stream().forEach(wp->{
  206. List<Project> projects = wppromap.get(wp.getId());
  207. Map<String, Windpowerstationpointnew> wppointnewMap = wppointmap.get(wp.getId());
  208. AtomicReference<Double> wpdaydjloss = new AtomicReference<>(0.0);
  209. AtomicReference<Double> wpmonthdjloss = new AtomicReference<>(0.0);
  210. AtomicReference<Double> wpyeardjloss = new AtomicReference<>(0.0);
  211. AtomicReference<Double> wpdaysdtjloss = new AtomicReference<>(0.0);
  212. AtomicReference<Double> wpmonthsdtjloss = new AtomicReference<>(0.0);
  213. AtomicReference<Double> wpyearsdtjloss = new AtomicReference<>(0.0);
  214. AtomicReference<Double> wpdayxnloss = new AtomicReference<>(0.0);
  215. AtomicReference<Double> wpmonthxnloss = new AtomicReference<>(0.0);
  216. AtomicReference<Double> wpyearxnloss = new AtomicReference<>(0.0);
  217. AtomicReference<Double> wpdayfdjclloss = new AtomicReference<>(0.0);
  218. AtomicReference<Double> wpmonthfdjclloss = new AtomicReference<>(0.0);
  219. AtomicReference<Double> wpyearfdjclloss = new AtomicReference<>(0.0);
  220. AtomicReference<Double> wpdaygzloss = new AtomicReference<>(0.0);
  221. AtomicReference<Double> wpmonthgzloss = new AtomicReference<>(0.0);
  222. AtomicReference<Double> wpyeargzloss = new AtomicReference<>(0.0);
  223. AtomicReference<Double> wpdaygzslloss = new AtomicReference<>(0.0);
  224. AtomicReference<Double> wpmonthgzslloss = new AtomicReference<>(0.0);
  225. AtomicReference<Double> wpyeargzslloss = new AtomicReference<>(0.0);
  226. AtomicReference<Double> wpdaywhloss = new AtomicReference<>(0.0);
  227. AtomicReference<Double> wpmonthwhloss = new AtomicReference<>(0.0);
  228. AtomicReference<Double> wpyearwhloss = new AtomicReference<>(0.0);
  229. AtomicReference<Double> wpdaywhslloss = new AtomicReference<>(0.0);
  230. AtomicReference<Double> wpmonthwhslloss = new AtomicReference<>(0.0);
  231. AtomicReference<Double> wpyearwhslloss = new AtomicReference<>(0.0);
  232. AtomicReference<Double> wpdayxdtjloss = new AtomicReference<>(0.0);
  233. AtomicReference<Double> wpmonthxdtjloss = new AtomicReference<>(0.0);
  234. AtomicReference<Double> wpyearxdtjloss = new AtomicReference<>(0.0);
  235. AtomicReference<Double> wpdayxdjclloss = new AtomicReference<>(0.0);
  236. AtomicReference<Double> wpmonthxdjclloss = new AtomicReference<>(0.0);
  237. AtomicReference<Double> wpyearxdjclloss = new AtomicReference<>(0.0);
  238. AtomicReference<Double> wpdaydwslloss = new AtomicReference<>(0.0);
  239. AtomicReference<Double> wpmonthdwslloss = new AtomicReference<>(0.0);
  240. AtomicReference<Double> wpyeardwslloss = new AtomicReference<>(0.0);
  241. AtomicReference<Double> wpdayhjslloss = new AtomicReference<>(0.0);
  242. AtomicReference<Double> wpmonthhjslloss = new AtomicReference<>(0.0);
  243. AtomicReference<Double> wpyearhjslloss = new AtomicReference<>(0.0);
  244. AtomicReference<Double> wpdayqf0 = new AtomicReference<>(0.0);
  245. AtomicReference<Double> wpdayqf1 = new AtomicReference<>(0.0);
  246. AtomicReference<Double> wpdayqf2 = new AtomicReference<>(0.0);
  247. AtomicReference<Double> wpdayqf3 = new AtomicReference<>(0.0);
  248. AtomicReference<Double> wpdayqf4= new AtomicReference<>(0.0);
  249. projects.stream().forEach(project -> {
  250. List<Line> lines = prolinemap.get(project.getId());
  251. Map<String, Windpowerstationpointnew> projectpointnewMap = propointmap.get(project.getId());
  252. AtomicReference<Double> projectdaydjloss = new AtomicReference<>(0.0);
  253. AtomicReference<Double> projectmonthdjloss = new AtomicReference<>(0.0);
  254. AtomicReference<Double> projectyeardjloss = new AtomicReference<>(0.0);
  255. AtomicReference<Double> projectdaysdtjloss = new AtomicReference<>(0.0);
  256. AtomicReference<Double> projectmonthsdtjloss = new AtomicReference<>(0.0);
  257. AtomicReference<Double> projectyearsdtjloss = new AtomicReference<>(0.0);
  258. AtomicReference<Double> projectdayxnloss = new AtomicReference<>(0.0);
  259. AtomicReference<Double> projectmonthxnloss = new AtomicReference<>(0.0);
  260. AtomicReference<Double> projectyearxnloss = new AtomicReference<>(0.0);
  261. AtomicReference<Double> projectdayfdjclloss = new AtomicReference<>(0.0);
  262. AtomicReference<Double> projectmonthfdjclloss = new AtomicReference<>(0.0);
  263. AtomicReference<Double> projectyearfdjclloss = new AtomicReference<>(0.0);
  264. AtomicReference<Double> projectdaygzloss = new AtomicReference<>(0.0);
  265. AtomicReference<Double> projectmonthgzloss = new AtomicReference<>(0.0);
  266. AtomicReference<Double> projectyeargzloss = new AtomicReference<>(0.0);
  267. AtomicReference<Double> projectdaygzslloss = new AtomicReference<>(0.0);
  268. AtomicReference<Double> projectmonthgzslloss = new AtomicReference<>(0.0);
  269. AtomicReference<Double> projectyeargzslloss = new AtomicReference<>(0.0);
  270. AtomicReference<Double> projectdaywhloss = new AtomicReference<>(0.0);
  271. AtomicReference<Double> projectmonthwhloss = new AtomicReference<>(0.0);
  272. AtomicReference<Double> projectyearwhloss = new AtomicReference<>(0.0);
  273. AtomicReference<Double> projectdaywhslloss = new AtomicReference<>(0.0);
  274. AtomicReference<Double> projectmonthwhslloss = new AtomicReference<>(0.0);
  275. AtomicReference<Double> projectyearwhslloss = new AtomicReference<>(0.0);
  276. AtomicReference<Double> projectdayxdtjloss = new AtomicReference<>(0.0);
  277. AtomicReference<Double> projectmonthxdtjloss = new AtomicReference<>(0.0);
  278. AtomicReference<Double> projectyearxdtjloss = new AtomicReference<>(0.0);
  279. AtomicReference<Double> projectdayxdjclloss = new AtomicReference<>(0.0);
  280. AtomicReference<Double> projectmonthxdjclloss = new AtomicReference<>(0.0);
  281. AtomicReference<Double> projectyearxdjclloss = new AtomicReference<>(0.0);
  282. AtomicReference<Double> projectdaydwslloss = new AtomicReference<>(0.0);
  283. AtomicReference<Double> projectmonthdwslloss = new AtomicReference<>(0.0);
  284. AtomicReference<Double> projectyeardwslloss = new AtomicReference<>(0.0);
  285. AtomicReference<Double> projectdayhjslloss = new AtomicReference<>(0.0);
  286. AtomicReference<Double> projectmonthhjslloss = new AtomicReference<>(0.0);
  287. AtomicReference<Double> projectyearhjslloss = new AtomicReference<>(0.0);
  288. AtomicReference<Double> projectdayqf0 = new AtomicReference<>(0.0);
  289. AtomicReference<Double> projectdayqf1 = new AtomicReference<>(0.0);
  290. AtomicReference<Double> projectdayqf2 = new AtomicReference<>(0.0);
  291. AtomicReference<Double> projectdayqf3 = new AtomicReference<>(0.0);
  292. AtomicReference<Double> projectdayqf4 = new AtomicReference<>(0.0);
  293. lines.stream().forEach(line -> {
  294. List<Windturbine> windturbines = linewtmap.get(line.getId());
  295. Map<String, Windpowerstationpointnew> linepointnewMap = linepointmap.get(line.getId());
  296. AtomicReference<Double> linedaydjloss = new AtomicReference<>(0.0);
  297. AtomicReference<Double> linemonthdjloss = new AtomicReference<>(0.0);
  298. AtomicReference<Double> lineyeardjloss = new AtomicReference<>(0.0);
  299. AtomicReference<Double> linedaysdtjloss = new AtomicReference<>(0.0);
  300. AtomicReference<Double> linemonthsdtjloss = new AtomicReference<>(0.0);
  301. AtomicReference<Double> lineyearsdtjloss = new AtomicReference<>(0.0);
  302. AtomicReference<Double> linedayxnloss = new AtomicReference<>(0.0);
  303. AtomicReference<Double> linemonthxnloss = new AtomicReference<>(0.0);
  304. AtomicReference<Double> lineyearxnloss = new AtomicReference<>(0.0);
  305. AtomicReference<Double> linedayfdjclloss = new AtomicReference<>(0.0);
  306. AtomicReference<Double> linemonthfdjclloss = new AtomicReference<>(0.0);
  307. AtomicReference<Double> lineyearfdjclloss = new AtomicReference<>(0.0);
  308. AtomicReference<Double> linedaygzloss = new AtomicReference<>(0.0);
  309. AtomicReference<Double> linemonthgzloss = new AtomicReference<>(0.0);
  310. AtomicReference<Double> lineyeargzloss = new AtomicReference<>(0.0);
  311. AtomicReference<Double> linedaygzslloss = new AtomicReference<>(0.0);
  312. AtomicReference<Double> linemonthgzslloss = new AtomicReference<>(0.0);
  313. AtomicReference<Double> lineyeargzslloss = new AtomicReference<>(0.0);
  314. AtomicReference<Double> linedaywhloss = new AtomicReference<>(0.0);
  315. AtomicReference<Double> linemonthwhloss = new AtomicReference<>(0.0);
  316. AtomicReference<Double> lineyearwhloss = new AtomicReference<>(0.0);
  317. AtomicReference<Double> linedaywhslloss = new AtomicReference<>(0.0);
  318. AtomicReference<Double> linemonthwhslloss = new AtomicReference<>(0.0);
  319. AtomicReference<Double> lineyearwhslloss = new AtomicReference<>(0.0);
  320. AtomicReference<Double> linedayxdtjloss = new AtomicReference<>(0.0);
  321. AtomicReference<Double> linemonthxdtjloss = new AtomicReference<>(0.0);
  322. AtomicReference<Double> lineyearxdtjloss = new AtomicReference<>(0.0);
  323. AtomicReference<Double> linedayxdjclloss = new AtomicReference<>(0.0);
  324. AtomicReference<Double> linemonthxdjclloss = new AtomicReference<>(0.0);
  325. AtomicReference<Double> lineyearxdjclloss = new AtomicReference<>(0.0);
  326. AtomicReference<Double> linedaydwslloss = new AtomicReference<>(0.0);
  327. AtomicReference<Double> linemonthdwslloss = new AtomicReference<>(0.0);
  328. AtomicReference<Double> lineyeardwslloss = new AtomicReference<>(0.0);
  329. AtomicReference<Double> linedayhjslloss = new AtomicReference<>(0.0);
  330. AtomicReference<Double> linemonthhjslloss = new AtomicReference<>(0.0);
  331. AtomicReference<Double> lineyearhjslloss = new AtomicReference<>(0.0);
  332. AtomicReference<Double> linedayqf0 = new AtomicReference<>(0.0);
  333. AtomicReference<Double> linedayqf1 = new AtomicReference<>(0.0);
  334. AtomicReference<Double> linedayqf2 = new AtomicReference<>(0.0);
  335. AtomicReference<Double> linedayqf3 = new AtomicReference<>(0.0);
  336. AtomicReference<Double> linedayqf4 = new AtomicReference<>(0.0);
  337. windturbines.stream().forEach(wt->{
  338. Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
  339. //待机
  340. Windturbinetestingpointnew dayDjPoint = windturbinetestingpointnewMap.get(Contant.WTRDJSSDL);
  341. Windturbinetestingpointnew monthDjPoint = windturbinetestingpointnewMap.get(Contant.WTYDJSSDL);
  342. Windturbinetestingpointnew yearDjPoint = windturbinetestingpointnewMap.get(Contant.WTNDJSSDL);
  343. geneLineloss(linedaydjloss, linemonthdjloss, lineyeardjloss, dayDjPoint, monthDjPoint, yearDjPoint);
  344. //手动停机
  345. Windturbinetestingpointnew daySdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRSTSSDL);
  346. Windturbinetestingpointnew monthSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYSTSSDL);
  347. Windturbinetestingpointnew yearSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNSTSSDL);
  348. geneLineloss(linedaysdtjloss, linemonthsdtjloss, lineyearsdtjloss, daySdtjPoint, monthSdtjPoint, yearSdtjPoint);
  349. //性能
  350. Windturbinetestingpointnew dayXnPoint = windturbinetestingpointnewMap.get(Contant.WTRXNSSDL);
  351. Windturbinetestingpointnew monthXnPoint = windturbinetestingpointnewMap.get(Contant.WTYXNSSDL);
  352. Windturbinetestingpointnew yearXnPoint = windturbinetestingpointnewMap.get(Contant.WTNXNSSDL);
  353. geneLineloss(linedayxnloss, linemonthxnloss, lineyearxnloss, dayXnPoint, monthXnPoint, yearXnPoint);
  354. //发电降出力
  355. Windturbinetestingpointnew dayFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQXSSDL);
  356. Windturbinetestingpointnew monthFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQXSSDL);
  357. Windturbinetestingpointnew yearFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQXSSDL);
  358. geneLineloss(linedayfdjclloss, linemonthfdjclloss, lineyearfdjclloss, dayFdjclPoint, monthFdjclPoint, yearFdjclPoint);
  359. //故障
  360. Windturbinetestingpointnew dayGzPoint = windturbinetestingpointnewMap.get(Contant.WTRGZSSDL);
  361. Windturbinetestingpointnew monthGzPoint = windturbinetestingpointnewMap.get(Contant.WTYGZSSDL);
  362. Windturbinetestingpointnew yearGzPoint = windturbinetestingpointnewMap.get(Contant.WTNGZSSDL);
  363. geneLineloss(linedaygzloss, linemonthgzloss, lineyeargzloss, dayGzPoint, monthGzPoint, yearGzPoint);
  364. //故障受累
  365. Windturbinetestingpointnew dayGzslPoint = windturbinetestingpointnewMap.get(Contant.WTRSZSSDL);
  366. Windturbinetestingpointnew monthGzslPoint = windturbinetestingpointnewMap.get(Contant.WTYSZSSDL);
  367. Windturbinetestingpointnew yearGzslPoint = windturbinetestingpointnewMap.get(Contant.WTNSZSSDL);
  368. geneLineloss(linedaygzslloss, linemonthgzslloss, lineyeargzslloss, dayGzslPoint, monthGzslPoint, yearGzslPoint);
  369. //维护
  370. Windturbinetestingpointnew dayWhPoint = windturbinetestingpointnewMap.get(Contant.WTRJXSSDL);
  371. Windturbinetestingpointnew monthWhPoint = windturbinetestingpointnewMap.get(Contant.WTYJXSSDL);
  372. Windturbinetestingpointnew yearWhPoint = windturbinetestingpointnewMap.get(Contant.WTNJXSSDL);
  373. geneLineloss(linedaywhloss, linemonthwhloss, lineyearwhloss, dayWhPoint, monthWhPoint, yearWhPoint);
  374. //维护受累
  375. Windturbinetestingpointnew dayWhslPoint = windturbinetestingpointnewMap.get(Contant.WTRLZSSDL);
  376. Windturbinetestingpointnew monthWhslPoint = windturbinetestingpointnewMap.get(Contant.WTYLZSSDL);
  377. Windturbinetestingpointnew yearWhslPoint = windturbinetestingpointnewMap.get(Contant.WTNLZSSDL);
  378. geneLineloss(linedaywhslloss, linemonthwhslloss, lineyearwhslloss, dayWhslPoint, monthWhslPoint, yearWhslPoint);
  379. //限电降出力
  380. Windturbinetestingpointnew dayXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQFSSDL);
  381. Windturbinetestingpointnew monthXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQFSSDL);
  382. Windturbinetestingpointnew yearXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQFSSDL);
  383. geneLineloss(linedayxdjclloss, linemonthxdjclloss, lineyearxdjclloss, dayXdjclPoint, monthXdjclPoint, yearXdjclPoint);
  384. //限电停机
  385. Windturbinetestingpointnew dayXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRXDSSDL);
  386. Windturbinetestingpointnew monthXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYXDSSDL);
  387. Windturbinetestingpointnew yearXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNXDSSDL);
  388. geneLineloss(linedayxdtjloss, linemonthxdtjloss, lineyearxdtjloss, dayXdtjPoint, monthXdtjPoint, yearXdtjPoint);
  389. //电网受累
  390. Windturbinetestingpointnew dayDwslPoint = windturbinetestingpointnewMap.get(Contant.WTRWZSSDL);
  391. Windturbinetestingpointnew monthDwslPoint = windturbinetestingpointnewMap.get(Contant.WTYWZSSDL);
  392. Windturbinetestingpointnew yearDwslPoint = windturbinetestingpointnewMap.get(Contant.WTNWZSSDL);
  393. geneLineloss(linedaydwslloss, linemonthdwslloss, lineyeardwslloss, dayDwslPoint, monthDwslPoint, yearDwslPoint);
  394. //环境受累
  395. Windturbinetestingpointnew dayHjslPoint = windturbinetestingpointnewMap.get(Contant.WTRTZSSDL);
  396. Windturbinetestingpointnew monthHjslPoint = windturbinetestingpointnewMap.get(Contant.WTYTZSSDL);
  397. Windturbinetestingpointnew yearHjslPoint = windturbinetestingpointnewMap.get(Contant.WTNTZSSDL);
  398. geneLineloss(linedayhjslloss, linemonthhjslloss, lineyearhjslloss, dayHjslPoint, monthHjslPoint, yearHjslPoint);
  399. //欠发发电量
  400. Windturbinetestingpointnew dayqf0 = windturbinetestingpointnewMap.get(Contant.R0QFZT);
  401. Windturbinetestingpointnew dayqf1 = windturbinetestingpointnewMap.get(Contant.R1QFZT);
  402. Windturbinetestingpointnew dayqf2 = windturbinetestingpointnewMap.get(Contant.R2QFZT);
  403. Windturbinetestingpointnew dayqf3 = windturbinetestingpointnewMap.get(Contant.R3QFZT);
  404. Windturbinetestingpointnew dayqf4 = windturbinetestingpointnewMap.get(Contant.R4QFZT);
  405. geneLineQfloss(linedayqf0, linedayqf1, linedayqf2,linedayqf3,linedayqf4, dayqf0, dayqf1, dayqf2,dayqf3,dayqf4);
  406. });
  407. //待机
  408. addWpPoint(resultList, linepointnewMap.get(Contant.RSDJZSDL), linedaydjloss);
  409. addWpPoint(resultList, linepointnewMap.get(Contant.YSDJZSDL), linemonthdjloss);
  410. addWpPoint(resultList, linepointnewMap.get(Contant.NSDJZSDL), lineyeardjloss);
  411. projectdaydjloss.updateAndGet(v->new Double((double) (v + linedaydjloss.get())));
  412. projectmonthdjloss.updateAndGet(v->new Double((double) (v + linemonthdjloss.get())));
  413. projectyeardjloss.updateAndGet(v->new Double((double) (v + lineyeardjloss.get())));
  414. //手动停机
  415. addWpPoint(resultList, linepointnewMap.get(Contant.RSSTZSDL), linedaysdtjloss);
  416. addWpPoint(resultList, linepointnewMap.get(Contant.YSSTZSDL), linemonthsdtjloss);
  417. addWpPoint(resultList, linepointnewMap.get(Contant.NSSTZSDL), lineyearsdtjloss);
  418. projectdaysdtjloss.updateAndGet(v->new Double((double) (v + linedaysdtjloss.get())));
  419. projectmonthsdtjloss.updateAndGet(v->new Double((double) (v + linemonthsdtjloss.get())));
  420. projectyearsdtjloss.updateAndGet(v->new Double((double) (v + lineyearsdtjloss.get())));
  421. //性能
  422. addWpPoint(resultList, linepointnewMap.get(Contant.RXNZSDL), linedayxnloss);
  423. addWpPoint(resultList, linepointnewMap.get(Contant.YXNZSDL), linemonthxnloss);
  424. addWpPoint(resultList, linepointnewMap.get(Contant.NXNZSDL), lineyearxnloss);
  425. projectdayxnloss.updateAndGet(v->new Double((double) (v + linedayxnloss.get())));
  426. projectmonthxnloss.updateAndGet(v->new Double((double) (v + linemonthxnloss.get())));
  427. projectyearxnloss.updateAndGet(v->new Double((double) (v + lineyearxnloss.get())));
  428. //发电降出力
  429. addWpPoint(resultList, linepointnewMap.get(Contant.RSQXZSDL), linedayfdjclloss);
  430. addWpPoint(resultList, linepointnewMap.get(Contant.YSQXZSDL), linemonthfdjclloss);
  431. addWpPoint(resultList, linepointnewMap.get(Contant.NSQXZSDL), lineyearfdjclloss);
  432. projectdayfdjclloss.updateAndGet(v->new Double((double) (v + linedayfdjclloss.get())));
  433. projectmonthfdjclloss.updateAndGet(v->new Double((double) (v + linemonthfdjclloss.get())));
  434. projectyearfdjclloss.updateAndGet(v->new Double((double) (v + lineyearfdjclloss.get())));
  435. double xnss = linedaydjloss.get() + linedaysdtjloss.get() + linedayxnloss.get() + linedayfdjclloss.get();
  436. resultList.add(createWpPointData(linepointnewMap.get(Contant.XNSSDL),xnss));
  437. //故障
  438. addWpPoint(resultList, linepointnewMap.get(Contant.RGZZSDL), linedaygzloss);
  439. addWpPoint(resultList, linepointnewMap.get(Contant.YGZZSDL), linemonthgzloss);
  440. addWpPoint(resultList, linepointnewMap.get(Contant.NGZZSDL), lineyeargzloss);
  441. projectdaygzloss.updateAndGet(v->new Double((double) (v + linedaygzloss.get())));
  442. projectmonthgzloss.updateAndGet(v->new Double((double) (v + linemonthgzloss.get())));
  443. projectyeargzloss.updateAndGet(v->new Double((double) (v + lineyeargzloss.get())));
  444. //故障受累
  445. addWpPoint(resultList, linepointnewMap.get(Contant.RSZZSDL), linedaygzslloss);
  446. addWpPoint(resultList, linepointnewMap.get(Contant.YSZZSDL), linemonthgzslloss);
  447. addWpPoint(resultList, linepointnewMap.get(Contant.NSZZSDL), lineyeargzslloss);
  448. projectdaygzslloss.updateAndGet(v->new Double((double) (v + linedaygzslloss.get())));
  449. projectmonthgzslloss.updateAndGet(v->new Double((double) (v + linemonthgzslloss.get())));
  450. projectyeargzslloss.updateAndGet(v->new Double((double) (v + lineyeargzslloss.get())));
  451. double gzss = linedaygzloss.get()+linedaygzslloss.get();
  452. resultList.add(createWpPointData(linepointnewMap.get(Contant.GZSSDL),gzss));
  453. //维护
  454. addWpPoint(resultList, linepointnewMap.get(Contant.RJXZSDL), linedaywhloss);
  455. addWpPoint(resultList, linepointnewMap.get(Contant.YJXZSDL), linemonthwhloss);
  456. addWpPoint(resultList, linepointnewMap.get(Contant.NJXZSDL), lineyearwhloss);
  457. projectdaywhloss.updateAndGet(v->new Double((double) (v + linedaywhloss.get())));
  458. projectmonthwhloss.updateAndGet(v->new Double((double) (v + linemonthwhloss.get())));
  459. projectyearwhloss.updateAndGet(v->new Double((double) (v + lineyearwhloss.get())));
  460. //维护受累
  461. addWpPoint(resultList, linepointnewMap.get(Contant.RLZZSDL), linedaywhslloss);
  462. addWpPoint(resultList, linepointnewMap.get(Contant.YLZZSDL), linemonthwhslloss);
  463. addWpPoint(resultList, linepointnewMap.get(Contant.NLZZSDL), lineyearwhslloss);
  464. projectdaywhslloss.updateAndGet(v->new Double((double) (v + linedaywhslloss.get())));
  465. projectmonthwhslloss.updateAndGet(v->new Double((double) (v + linemonthwhslloss.get())));
  466. projectyearwhslloss.updateAndGet(v->new Double((double) (v + lineyearwhslloss.get())));
  467. double whss = linedaywhloss.get()+linedaywhslloss.get();
  468. resultList.add(createWpPointData(linepointnewMap.get(Contant.WHSSDL),whss));
  469. //限电降出力
  470. addWpPoint(resultList, linepointnewMap.get(Contant.RQFZSDL), linedayxdjclloss);
  471. addWpPoint(resultList, linepointnewMap.get(Contant.YQFZSDL), linemonthxdjclloss);
  472. addWpPoint(resultList, linepointnewMap.get(Contant.NQFZSDL), lineyearxdjclloss);
  473. projectdayxdjclloss.updateAndGet(v->new Double((double) (v + linedayxdjclloss.get())));
  474. projectmonthxdjclloss.updateAndGet(v->new Double((double) (v + linemonthxdjclloss.get())));
  475. projectyearxdjclloss.updateAndGet(v->new Double((double) (v + lineyearxdjclloss.get())));
  476. //限电停机
  477. addWpPoint(resultList, linepointnewMap.get(Contant.RXDZSDL), linedayxdtjloss);
  478. addWpPoint(resultList, linepointnewMap.get(Contant.YXDZSDL), linemonthxdtjloss);
  479. addWpPoint(resultList, linepointnewMap.get(Contant.NXDZSDL), lineyearxdtjloss);
  480. projectdayxdtjloss.updateAndGet(v->new Double((double) (v + linedayxdtjloss.get())));
  481. projectmonthxdtjloss.updateAndGet(v->new Double((double) (v + linemonthxdtjloss.get())));
  482. projectyearxdtjloss.updateAndGet(v->new Double((double) (v + lineyearxdtjloss.get())));
  483. double xdss = linedayxdjclloss.get()+linedayxdtjloss.get();
  484. resultList.add(createWpPointData(linepointnewMap.get(Contant.XDSSDL),xdss));
  485. //电网受累
  486. addWpPoint(resultList, linepointnewMap.get(Contant.RWZZSDL), linedaydwslloss);
  487. addWpPoint(resultList, linepointnewMap.get(Contant.YWZZSDL), linemonthdwslloss);
  488. addWpPoint(resultList, linepointnewMap.get(Contant.NWZZSDL), lineyeardwslloss);
  489. projectdaydwslloss.updateAndGet(v->new Double((double) (v + linedaydwslloss.get())));
  490. projectmonthdwslloss.updateAndGet(v->new Double((double) (v + linemonthdwslloss.get())));
  491. projectyeardwslloss.updateAndGet(v->new Double((double) (v + lineyeardwslloss.get())));
  492. //环境受累
  493. addWpPoint(resultList, linepointnewMap.get(Contant.RTZZSDL), linedayhjslloss);
  494. addWpPoint(resultList, linepointnewMap.get(Contant.YTZZSDL), linemonthhjslloss);
  495. addWpPoint(resultList, linepointnewMap.get(Contant.NTZZSDL), lineyearhjslloss);
  496. projectdayhjslloss.updateAndGet(v->new Double((double) (v + linedayhjslloss.get())));
  497. projectmonthhjslloss.updateAndGet(v->new Double((double) (v + linemonthhjslloss.get())));
  498. projectyearhjslloss.updateAndGet(v->new Double((double) (v + lineyearhjslloss.get())));
  499. double slss = linedayhjslloss.get()+linedaydwslloss.get();
  500. resultList.add(createWpPointData(linepointnewMap.get(Contant.SLSSDL),slss));
  501. //欠发发电量
  502. addWpPoint(resultList, linepointnewMap.get(Contant.R0QFZT), linedayqf0);
  503. addWpPoint(resultList, linepointnewMap.get(Contant.R1QFZT), linedayqf1);
  504. addWpPoint(resultList, linepointnewMap.get(Contant.R2QFZT), linedayqf2);
  505. addWpPoint(resultList, linepointnewMap.get(Contant.R3QFZT), linedayqf3);
  506. addWpPoint(resultList, linepointnewMap.get(Contant.R4QFZT), linedayqf4);
  507. projectdayqf0.updateAndGet(v->new Double((double) (v + linedayqf0.get())));
  508. projectdayqf1.updateAndGet(v->new Double((double) (v + linedayqf1.get())));
  509. projectdayqf2.updateAndGet(v->new Double((double) (v + linedayqf2.get())));
  510. projectdayqf3.updateAndGet(v->new Double((double) (v + linedayqf3.get())));
  511. projectdayqf4.updateAndGet(v->new Double((double) (v + linedayqf4.get())));
  512. });
  513. //待机
  514. addWpPoint(resultList, projectpointnewMap.get(Contant.RSDJZSDL), projectdaydjloss);
  515. addWpPoint(resultList, projectpointnewMap.get(Contant.YSDJZSDL), projectmonthdjloss);
  516. addWpPoint(resultList, projectpointnewMap.get(Contant.NSDJZSDL), projectyeardjloss);
  517. wpdaydjloss.updateAndGet(v->new Double((double) (v + projectdaydjloss.get())));
  518. wpmonthdjloss.updateAndGet(v->new Double((double) (v + projectmonthdjloss.get())));
  519. wpyeardjloss.updateAndGet(v->new Double((double) (v + projectyeardjloss.get())));
  520. //手动停机
  521. addWpPoint(resultList, projectpointnewMap.get(Contant.RSSTZSDL), projectdaysdtjloss);
  522. addWpPoint(resultList, projectpointnewMap.get(Contant.YSSTZSDL), projectmonthsdtjloss);
  523. addWpPoint(resultList, projectpointnewMap.get(Contant.NSSTZSDL), projectyearsdtjloss);
  524. wpdaysdtjloss.updateAndGet(v->new Double((double) (v + projectdaysdtjloss.get())));
  525. wpmonthsdtjloss.updateAndGet(v->new Double((double) (v + projectmonthsdtjloss.get())));
  526. wpyearsdtjloss.updateAndGet(v->new Double((double) (v + projectyearsdtjloss.get())));
  527. //性能
  528. addWpPoint(resultList, projectpointnewMap.get(Contant.RXNZSDL), projectdayxnloss);
  529. addWpPoint(resultList, projectpointnewMap.get(Contant.YXNZSDL), projectmonthxnloss);
  530. addWpPoint(resultList, projectpointnewMap.get(Contant.NXNZSDL), projectyearxnloss);
  531. wpdayxnloss.updateAndGet(v->new Double((double) (v + projectdayxnloss.get())));
  532. wpmonthxnloss.updateAndGet(v->new Double((double) (v + projectmonthxnloss.get())));
  533. wpyearxnloss.updateAndGet(v->new Double((double) (v + projectyearxnloss.get())));
  534. //发电降出力
  535. addWpPoint(resultList, projectpointnewMap.get(Contant.RSQXZSDL), projectdayfdjclloss);
  536. addWpPoint(resultList, projectpointnewMap.get(Contant.YSQXZSDL), projectmonthfdjclloss);
  537. addWpPoint(resultList, projectpointnewMap.get(Contant.NSQXZSDL), projectyearfdjclloss);
  538. wpdayfdjclloss.updateAndGet(v->new Double((double) (v + projectdayfdjclloss.get())));
  539. wpmonthfdjclloss.updateAndGet(v->new Double((double) (v + projectmonthfdjclloss.get())));
  540. wpyearfdjclloss.updateAndGet(v->new Double((double) (v + projectyearfdjclloss.get())));
  541. double xnss = projectdaydjloss.get() + projectdaysdtjloss.get()+projectdayxnloss.get()+projectdayfdjclloss.get();
  542. resultList.add(createWpPointData(projectpointnewMap.get(Contant.XNSSDL),xnss));
  543. //故障
  544. addWpPoint(resultList, projectpointnewMap.get(Contant.RGZZSDL), projectdaygzloss);
  545. addWpPoint(resultList, projectpointnewMap.get(Contant.YGZZSDL), projectmonthgzloss);
  546. addWpPoint(resultList, projectpointnewMap.get(Contant.NGZZSDL), projectyeargzloss);
  547. wpdaygzloss.updateAndGet(v->new Double((double) (v + projectdaygzloss.get())));
  548. wpmonthgzloss.updateAndGet(v->new Double((double) (v + projectmonthgzloss.get())));
  549. wpyeargzloss.updateAndGet(v->new Double((double) (v + projectyeargzloss.get())));
  550. //故障受累
  551. addWpPoint(resultList, projectpointnewMap.get(Contant.RSZZSDL), projectdaygzslloss);
  552. addWpPoint(resultList, projectpointnewMap.get(Contant.YSZZSDL), projectmonthgzslloss);
  553. addWpPoint(resultList, projectpointnewMap.get(Contant.NSZZSDL), projectyeargzslloss);
  554. wpdaygzslloss.updateAndGet(v->new Double((double) (v + projectdaygzslloss.get())));
  555. wpmonthgzslloss.updateAndGet(v->new Double((double) (v + projectmonthgzslloss.get())));
  556. wpyeargzslloss.updateAndGet(v->new Double((double) (v + projectyeargzslloss.get())));
  557. double gzss = projectdaygzloss.get() + projectdaygzslloss.get();
  558. resultList.add(createWpPointData(projectpointnewMap.get(Contant.GZSSDL),gzss));
  559. //维护
  560. addWpPoint(resultList, projectpointnewMap.get(Contant.RJXZSDL), projectdaywhloss);
  561. addWpPoint(resultList, projectpointnewMap.get(Contant.YJXZSDL), projectmonthwhloss);
  562. addWpPoint(resultList, projectpointnewMap.get(Contant.NJXZSDL), projectyearwhloss);
  563. wpdaywhloss.updateAndGet(v->new Double((double) (v + projectdaywhloss.get())));
  564. wpmonthwhloss.updateAndGet(v->new Double((double) (v + projectmonthwhloss.get())));
  565. wpyearwhloss.updateAndGet(v->new Double((double) (v + projectyearwhloss.get())));
  566. //维护受累
  567. addWpPoint(resultList, projectpointnewMap.get(Contant.RLZZSDL), projectdaywhslloss);
  568. addWpPoint(resultList, projectpointnewMap.get(Contant.YLZZSDL), projectmonthwhslloss);
  569. addWpPoint(resultList, projectpointnewMap.get(Contant.NLZZSDL), projectyearwhslloss);
  570. wpdaywhslloss.updateAndGet(v->new Double((double) (v + projectdaywhslloss.get())));
  571. wpmonthwhslloss.updateAndGet(v->new Double((double) (v + projectmonthwhslloss.get())));
  572. wpyearwhslloss.updateAndGet(v->new Double((double) (v + projectyearwhslloss.get())));
  573. double whss = projectdaywhloss.get() + projectdaywhslloss.get();
  574. resultList.add(createWpPointData(projectpointnewMap.get(Contant.WHSSDL),whss));
  575. //限电降出力
  576. addWpPoint(resultList, projectpointnewMap.get(Contant.RQFZSDL), projectdayxdjclloss);
  577. addWpPoint(resultList, projectpointnewMap.get(Contant.YQFZSDL), projectmonthxdjclloss);
  578. addWpPoint(resultList, projectpointnewMap.get(Contant.NQFZSDL), projectyearxdjclloss);
  579. wpdayxdjclloss.updateAndGet(v->new Double((double) (v + projectdayxdjclloss.get())));
  580. wpmonthxdjclloss.updateAndGet(v->new Double((double) (v + projectmonthxdjclloss.get())));
  581. wpyearxdjclloss.updateAndGet(v->new Double((double) (v + projectyearxdjclloss.get())));
  582. //限电停机
  583. addWpPoint(resultList, projectpointnewMap.get(Contant.RXDZSDL), projectdayxdtjloss);
  584. addWpPoint(resultList, projectpointnewMap.get(Contant.YXDZSDL), projectmonthxdtjloss);
  585. addWpPoint(resultList, projectpointnewMap.get(Contant.NXDZSDL), projectyearxdtjloss);
  586. wpdayxdtjloss.updateAndGet(v->new Double((double) (v + projectdayxdtjloss.get())));
  587. wpmonthxdtjloss.updateAndGet(v->new Double((double) (v + projectmonthxdtjloss.get())));
  588. wpyearxdtjloss.updateAndGet(v->new Double((double) (v + projectyearxdtjloss.get())));
  589. double xdss = projectdayxdjclloss.get() + projectdayxdtjloss.get();
  590. resultList.add(createWpPointData(projectpointnewMap.get(Contant.XDSSDL),xdss));
  591. //电网受累
  592. addWpPoint(resultList, projectpointnewMap.get(Contant.RWZZSDL), projectdaydwslloss);
  593. addWpPoint(resultList, projectpointnewMap.get(Contant.YWZZSDL), projectmonthdwslloss);
  594. addWpPoint(resultList, projectpointnewMap.get(Contant.NWZZSDL), projectyeardwslloss);
  595. wpdaydwslloss.updateAndGet(v->new Double((double) (v + projectdaydwslloss.get())));
  596. wpmonthdwslloss.updateAndGet(v->new Double((double) (v + projectmonthdwslloss.get())));
  597. wpyeardwslloss.updateAndGet(v->new Double((double) (v + projectyeardwslloss.get())));
  598. //环境受累
  599. addWpPoint(resultList, projectpointnewMap.get(Contant.RTZZSDL), projectdayhjslloss);
  600. addWpPoint(resultList, projectpointnewMap.get(Contant.YTZZSDL), projectmonthhjslloss);
  601. addWpPoint(resultList, projectpointnewMap.get(Contant.NTZZSDL), projectyearhjslloss);
  602. wpdayhjslloss.updateAndGet(v->new Double((double) (v + projectdayhjslloss.get())));
  603. wpmonthhjslloss.updateAndGet(v->new Double((double) (v + projectmonthhjslloss.get())));
  604. wpyearhjslloss.updateAndGet(v->new Double((double) (v + projectyearhjslloss.get())));
  605. double slss = projectdaydwslloss.get() + projectdayhjslloss.get();
  606. resultList.add(createWpPointData(projectpointnewMap.get(Contant.SLSSDL),slss));
  607. //欠发发电量
  608. addWpPoint(resultList, projectpointnewMap.get(Contant.R0QFZT), projectdayqf0);
  609. addWpPoint(resultList, projectpointnewMap.get(Contant.R1QFZT), projectdayqf1);
  610. addWpPoint(resultList, projectpointnewMap.get(Contant.R2QFZT), projectdayqf2);
  611. addWpPoint(resultList, projectpointnewMap.get(Contant.R3QFZT), projectdayqf3);
  612. addWpPoint(resultList, projectpointnewMap.get(Contant.R4QFZT), projectdayqf4);
  613. wpdayqf0.updateAndGet(v->new Double((double) (v + projectdayqf0.get())));
  614. wpdayqf1.updateAndGet(v->new Double((double) (v + projectdayqf1.get())));
  615. wpdayqf2.updateAndGet(v->new Double((double) (v + projectdayqf2.get())));
  616. wpdayqf3.updateAndGet(v->new Double((double) (v + projectdayqf3.get())));
  617. wpdayqf4.updateAndGet(v->new Double((double) (v + projectdayqf4.get())));
  618. });
  619. //待机
  620. addWpPoint(resultList, wppointnewMap.get(Contant.RSDJZSDL), wpdaydjloss);
  621. addWpPoint(resultList, wppointnewMap.get(Contant.YSDJZSDL), wpmonthdjloss);
  622. addWpPoint(resultList, wppointnewMap.get(Contant.NSDJZSDL), wpyeardjloss);
  623. //手动停机
  624. addWpPoint(resultList, wppointnewMap.get(Contant.RSSTZSDL), wpdaysdtjloss);
  625. addWpPoint(resultList, wppointnewMap.get(Contant.YSSTZSDL), wpmonthsdtjloss);
  626. addWpPoint(resultList, wppointnewMap.get(Contant.NSSTZSDL), wpyearsdtjloss);
  627. //性能
  628. addWpPoint(resultList, wppointnewMap.get(Contant.RXNZSDL), wpdayxnloss);
  629. addWpPoint(resultList, wppointnewMap.get(Contant.YXNZSDL), wpmonthxnloss);
  630. addWpPoint(resultList, wppointnewMap.get(Contant.NXNZSDL), wpyearxnloss);
  631. //发电降出力
  632. addWpPoint(resultList, wppointnewMap.get(Contant.RSQXZSDL), wpdayfdjclloss);
  633. addWpPoint(resultList, wppointnewMap.get(Contant.YSQXZSDL), wpmonthfdjclloss);
  634. addWpPoint(resultList, wppointnewMap.get(Contant.NSQXZSDL), wpyearfdjclloss);
  635. double xnss = wpdaydjloss.get() + wpdaysdtjloss.get()+wpdayxnloss.get()+wpdayfdjclloss.get();
  636. resultList.add(createWpPointData(wppointnewMap.get(Contant.XNSSDL),xnss));
  637. //故障
  638. addWpPoint(resultList, wppointnewMap.get(Contant.RGZZSDL), wpdaygzloss);
  639. addWpPoint(resultList, wppointnewMap.get(Contant.YGZZSDL), wpmonthgzloss);
  640. addWpPoint(resultList, wppointnewMap.get(Contant.NGZZSDL), wpyeargzloss);
  641. //故障受累
  642. addWpPoint(resultList, wppointnewMap.get(Contant.RSZZSDL), wpdaygzslloss);
  643. addWpPoint(resultList, wppointnewMap.get(Contant.YSZZSDL), wpmonthgzslloss);
  644. addWpPoint(resultList, wppointnewMap.get(Contant.NSZZSDL), wpyeargzslloss);
  645. double gzss = wpdaygzloss.get() + wpdaygzslloss.get();
  646. resultList.add(createWpPointData(wppointnewMap.get(Contant.GZSSDL),gzss));
  647. //维护
  648. addWpPoint(resultList, wppointnewMap.get(Contant.RJXZSDL), wpdaywhloss);
  649. addWpPoint(resultList, wppointnewMap.get(Contant.YJXZSDL), wpmonthwhloss);
  650. addWpPoint(resultList, wppointnewMap.get(Contant.NJXZSDL), wpyearwhloss);
  651. //维护受累
  652. addWpPoint(resultList, wppointnewMap.get(Contant.RLZZSDL), wpdaywhslloss);
  653. addWpPoint(resultList, wppointnewMap.get(Contant.YLZZSDL), wpmonthwhslloss);
  654. addWpPoint(resultList, wppointnewMap.get(Contant.NLZZSDL), wpyearwhslloss);
  655. double whss = wpdaywhloss.get() + wpdaywhslloss.get();
  656. resultList.add(createWpPointData(wppointnewMap.get(Contant.WHSSDL),whss));
  657. //限电降出力
  658. addWpPoint(resultList, wppointnewMap.get(Contant.RQFZSDL), wpdayxdjclloss);
  659. addWpPoint(resultList, wppointnewMap.get(Contant.YQFZSDL), wpmonthxdjclloss);
  660. addWpPoint(resultList, wppointnewMap.get(Contant.NQFZSDL), wpyearxdjclloss);
  661. //限电停机
  662. addWpPoint(resultList, wppointnewMap.get(Contant.RXDZSDL), wpdayxdtjloss);
  663. addWpPoint(resultList, wppointnewMap.get(Contant.YXDZSDL), wpmonthxdtjloss);
  664. addWpPoint(resultList, wppointnewMap.get(Contant.NXDZSDL), wpyearxdtjloss);
  665. double xdss = wpdayxdjclloss.get() + wpdayxdtjloss.get();
  666. resultList.add(createWpPointData(wppointnewMap.get(Contant.XDSSDL),xdss));
  667. //电网受累
  668. addWpPoint(resultList, wppointnewMap.get(Contant.RWZZSDL), wpdaydwslloss);
  669. addWpPoint(resultList, wppointnewMap.get(Contant.YWZZSDL), wpmonthdwslloss);
  670. addWpPoint(resultList, wppointnewMap.get(Contant.NWZZSDL), wpyeardwslloss);
  671. //环境受累
  672. addWpPoint(resultList, wppointnewMap.get(Contant.RTZZSDL), wpdayhjslloss);
  673. addWpPoint(resultList, wppointnewMap.get(Contant.YTZZSDL), wpmonthhjslloss);
  674. addWpPoint(resultList, wppointnewMap.get(Contant.NTZZSDL), wpyearhjslloss);
  675. double slss = wpdaydwslloss.get() + wpdayhjslloss.get();
  676. resultList.add(createWpPointData(wppointnewMap.get(Contant.SLSSDL),slss));
  677. //欠发发电量
  678. addWpPoint(resultList, wppointnewMap.get(Contant.R0QFZT), wpdayqf0);
  679. addWpPoint(resultList, wppointnewMap.get(Contant.R1QFZT), wpdayqf1);
  680. addWpPoint(resultList, wppointnewMap.get(Contant.R2QFZT), wpdayqf2);
  681. addWpPoint(resultList, wppointnewMap.get(Contant.R3QFZT), wpdayqf3);
  682. addWpPoint(resultList, wppointnewMap.get(Contant.R4QFZT), wpdayqf4);
  683. });
  684. edosUtil.sendMultiPoint(resultList);
  685. }
  686. private void geneLineQfloss(AtomicReference<Double> linedayqf0, AtomicReference<Double> linedayqf1, AtomicReference<Double> linedayqf2, AtomicReference<Double> linedayqf3, AtomicReference<Double> linedayqf4, Windturbinetestingpointnew dayqf0, Windturbinetestingpointnew dayqf1, Windturbinetestingpointnew dayqf2, Windturbinetestingpointnew dayqf3, Windturbinetestingpointnew dayqf4) {
  687. double wtdayqf0 = 0.0;
  688. double wtdayqf1 = 0.0;
  689. double wtdayqf2 = 0.0;
  690. double wtdayqf3 = 0.0;
  691. double wtdayqf4 = 0.0;
  692. try {
  693. wtdayqf0 = edosUtil.getSectionData(dayqf0,tomorrow.getTime()).getPointValueInDouble();
  694. wtdayqf1 = edosUtil.getSectionData(dayqf1,tomorrow.getTime()).getPointValueInDouble();
  695. wtdayqf2 = edosUtil.getSectionData(dayqf2,tomorrow.getTime()).getPointValueInDouble();
  696. wtdayqf3 = edosUtil.getSectionData(dayqf3,tomorrow.getTime()).getPointValueInDouble();
  697. wtdayqf4 = edosUtil.getSectionData(dayqf4,tomorrow.getTime()).getPointValueInDouble();
  698. } catch (Exception e) {
  699. e.printStackTrace();
  700. }
  701. double finalWtdayqf = wtdayqf0;
  702. linedayqf0.updateAndGet(v -> new Double((double) (v + finalWtdayqf)));
  703. double finalWtdayqf1 = wtdayqf1;
  704. linedayqf1.updateAndGet(v -> new Double((double) (v + finalWtdayqf1)));
  705. double finalWtdayqf2 = wtdayqf2;
  706. linedayqf2.updateAndGet(v -> new Double((double) (v + finalWtdayqf2)));
  707. double finalWtdayqf3 = wtdayqf3;
  708. linedayqf3.updateAndGet(v -> new Double((double) (v + finalWtdayqf3)));
  709. double finalWtdayqf4 = wtdayqf4;
  710. linedayqf4.updateAndGet(v -> new Double((double) (v + finalWtdayqf4)));
  711. }
  712. private void addWpPoint(List<PointData> resultList, Windpowerstationpointnew pointnew, AtomicReference<Double> linedaydjloss) {
  713. PointData wpPointData = createWpPointData(pointnew, linedaydjloss.get());
  714. resultList.add(wpPointData);
  715. }
  716. private void geneLineloss(AtomicReference<Double> linedaydjloss, AtomicReference<Double> linemonthdjloss, AtomicReference<Double> lineyeardjloss, Windturbinetestingpointnew dayDjPoint, Windturbinetestingpointnew monthDjPoint, Windturbinetestingpointnew yearDjPoint) {
  717. double wtdaydj = 0.0;
  718. double wtmonthdj = 0.0;
  719. double wtyeardj = 0.0;
  720. try {
  721. wtdaydj = edosUtil.getSectionData(dayDjPoint,tomorrow.getTime()).getPointValueInDouble();
  722. wtmonthdj = edosUtil.getSectionData(monthDjPoint,tomorrow.getTime()).getPointValueInDouble();
  723. wtyeardj = edosUtil.getSectionData(yearDjPoint,tomorrow.getTime()).getPointValueInDouble();
  724. } catch (Exception e) {
  725. e.printStackTrace();
  726. }
  727. double finalWtdaydj = wtdaydj;
  728. linedaydjloss.updateAndGet(v -> new Double((double) (v + finalWtdaydj)));
  729. double finalWtmonthdj = wtmonthdj;
  730. linemonthdjloss.updateAndGet(v -> new Double((double) (v + finalWtmonthdj)));
  731. double finalWtyeardj = wtyeardj;
  732. lineyeardjloss.updateAndGet(v -> new Double((double) (v + finalWtyeardj)));
  733. }
  734. /**
  735. * 风机日五损,欠发状态,欠发电量
  736. * @throws Exception
  737. */
  738. private void wtDaylossesReal() throws Exception {
  739. List<PointData> resultList = new ArrayList<>();
  740. wtls.stream().forEach(wt->{
  741. Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
  742. Windturbinetestingpointnew powerPoint = windturbinetestingpointnewMap.get(Contant.AI130);
  743. Windturbinetestingpointnew ztmxPoint = windturbinetestingpointnewMap.get(Contant.ZTMX);
  744. Windturbinetestingpointnew bzglPoint = windturbinetestingpointnewMap.get(Contant.BZGL);
  745. Windturbinetestingpointnew zsglPoint = windturbinetestingpointnewMap.get(Contant.ZSGL);
  746. Windturbinetestingpointnew qfztPoint = windturbinetestingpointnewMap.get(Contant.RSSQFZT);
  747. List<PointData> powerDatasSnap = null;
  748. List<PointData> ztmxDatasSnap = null;
  749. List<PointData> bzglDatasSnap = null;
  750. List<PointData> zsglDatasSnap = null;
  751. List<PointData> qfztDatasSnap = null;
  752. try {
  753. powerDatasSnap = edosUtil.getHistoryDatasSnap(powerPoint, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, null, 60l);
  754. if (powerDatasSnap.size()==1){
  755. return;
  756. }
  757. ztmxDatasSnap = edosUtil.getHistoryDatasSnap(ztmxPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
  758. bzglDatasSnap = edosUtil.getHistoryDatasSnap(bzglPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
  759. zsglDatasSnap = edosUtil.getHistoryDatasSnap(zsglPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
  760. qfztDatasSnap = edosUtil.getHistoryDatasSnap(qfztPoint,samedayZero.getTime()/1000,currentDate.getTime()/1000,null,60l);
  761. } catch (Exception e) {
  762. e.printStackTrace();
  763. }
  764. if (ztmxDatasSnap.size() == powerDatasSnap.size()){
  765. //待机损失
  766. double djss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 0.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRDJSSDL));
  767. //手动停机
  768. double sdtj = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 1.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRSTSSDL));
  769. //并网损失电量
  770. double bwss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 2.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRXNSSDL));
  771. //发电降出力
  772. double fdjcl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 3.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRQXSSDL));
  773. double xnss = djss + sdtj + bwss + fdjcl;
  774. resultList.add(createWtPointData(windturbinetestingpointnewMap.get(Contant.XNSSDL),xnss));
  775. //限电降出力
  776. double xdjcl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 4.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRQFSSDL));
  777. //限电停机
  778. double xdtj = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 5.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRXDSSDL));
  779. double xdss = xdjcl + xdtj;
  780. resultList.add(createWtPointData(windturbinetestingpointnewMap.get(Contant.XDSSDL),xdss));
  781. //故障
  782. double gzss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 6.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRGZSSDL));
  783. //故障受累
  784. double gzsl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 7.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRSZSSDL));
  785. double gzsss = gzss + gzsl;
  786. resultList.add(createWtPointData(windturbinetestingpointnewMap.get(Contant.GZSSDL),gzsss));
  787. //检修
  788. double jxss = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 8.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRJXSSDL));
  789. //检修受累
  790. double jxsl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 9.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRLZSSDL));
  791. double whss = jxss + jxsl;
  792. resultList.add(createWtPointData(windturbinetestingpointnewMap.get(Contant.WHSSDL),whss));
  793. //电网受累
  794. double dwsl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 10.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRWZSSDL));
  795. //环境受累
  796. double hjsl = generalLoss(ztmxDatasSnap, bzglDatasSnap, zsglDatasSnap, powerDatasSnap, 11.0, resultList, windturbinetestingpointnewMap.get(Contant.WTRTZSSDL));
  797. double slss = dwsl + hjsl;
  798. resultList.add(createWtPointData(windturbinetestingpointnewMap.get(Contant.SLSSDL),slss));
  799. //欠发状态
  800. generalQfzt(powerDatasSnap, ztmxDatasSnap, zsglDatasSnap,qfztPoint,resultList);
  801. //欠发电量
  802. generalQfss(qfztDatasSnap,bzglDatasSnap,zsglDatasSnap,powerDatasSnap,0.0,resultList,windturbinetestingpointnewMap.get(Contant.R0QFZT));
  803. generalQfss(qfztDatasSnap,bzglDatasSnap,zsglDatasSnap,powerDatasSnap,1.0,resultList,windturbinetestingpointnewMap.get(Contant.R1QFZT));
  804. generalQfss(qfztDatasSnap,bzglDatasSnap,zsglDatasSnap,powerDatasSnap,2.0,resultList,windturbinetestingpointnewMap.get(Contant.R2QFZT));
  805. generalQfss(qfztDatasSnap,bzglDatasSnap,zsglDatasSnap,powerDatasSnap,3.0,resultList,windturbinetestingpointnewMap.get(Contant.R3QFZT));
  806. generalQfss(qfztDatasSnap,bzglDatasSnap,zsglDatasSnap,powerDatasSnap,4.0,resultList,windturbinetestingpointnewMap.get(Contant.R4QFZT));
  807. }
  808. });
  809. edosUtil.sendMultiPoint(resultList);
  810. }
  811. private double generalQfss(List<PointData> ztmxDatasSnap, List<PointData> bzglDatasSnap, List<PointData> zsglDatasSnap, List<PointData> powerDatasSnap,Double statusValue,List<PointData> resultList,Windturbinetestingpointnew point) {
  812. List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
  813. Double bzss = 0.0;
  814. Double zsss = 0.0;
  815. for(int i= 0;i<ztmxDatasSnap.size();i++){
  816. for (int j=0;j<pointDataList.size();j++){
  817. if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
  818. if (i<bzglDatasSnap.size() && i<zsglDatasSnap.size() && i<powerDatasSnap.size()){
  819. double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
  820. double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
  821. double power = powerDatasSnap.get(i).getPointValueInDouble();
  822. double temp = bzgl - power;
  823. if (temp>0){
  824. bzss+=temp;
  825. }
  826. double temp1 = zsgl - power;
  827. if (temp1>0){
  828. zsss+=temp1;
  829. }
  830. // bzss += (bzgl-power<0?0:bzgl-power);
  831. // zsss += (zsgl-power<0?0:zsgl-power);
  832. }
  833. }
  834. }
  835. }
  836. bzss = bzss /60>=0?bzss/60:0;
  837. zsss = zsss/60>=0?zsss/60:0;
  838. //待有历史改为用自算损失
  839. PointData wtPointData = createWtPointData(point, zsss);
  840. resultList.add(wtPointData);
  841. return zsss;
  842. }
  843. private void generalQfzt(List<PointData> powerDatasSnap, List<PointData> ztmxDatasSnap, List<PointData> zsglDatasSnap,Windturbinetestingpointnew qfztPoint,List<PointData> resultList) {
  844. double zs = 0;
  845. double pp = 0;
  846. int i = 1;
  847. for ( ; i <= 5; i++) {
  848. zs += zsglDatasSnap.get(zsglDatasSnap.size()-i).getPointValueInDouble();
  849. pp += powerDatasSnap.get(powerDatasSnap.size()-1).getPointValueInDouble();
  850. }
  851. zs /= i;
  852. pp /= i;
  853. double ztmx = ztmxDatasSnap.get(ztmxDatasSnap.size() - 1).getPointValueInDouble();
  854. double[] underissuanceArray = {0,1,2,3,4,5,11};
  855. double qfzt = 0;
  856. if (Arrays.asList(underissuanceArray).contains(ztmx)){
  857. double ratioll = 0;
  858. if (zs != 0){
  859. ratioll = (zs-pp)/zs;
  860. }
  861. if (ratioll<0.05){
  862. qfzt = 0;
  863. }else if (ratioll >= 0.05 && ratioll < 0.1){
  864. qfzt = 1;
  865. }else if (ratioll >= 0.1 && ratioll < 0.2){
  866. qfzt = 2;
  867. }else if (ratioll >= 0.2 && ratioll < 0.4) {
  868. qfzt = 3;
  869. }else {
  870. qfzt = 4;
  871. }
  872. }
  873. PointData wtPointData = createWtPointData(qfztPoint, qfzt);
  874. resultList.add(wtPointData);
  875. }
  876. private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
  877. PointData pointData = new PointData();
  878. pointData.setEdnaId(linepointnew.getCode());
  879. pointData.setPointTime(currentDate.getTime());
  880. pointData.setPointName(linepointnew.getName());
  881. pointData.setPointValue(String.valueOf(linespeed));
  882. pointData.setPointValueInDouble(linespeed);
  883. return pointData;
  884. }
  885. /**
  886. * 风机月、年五损
  887. * @throws Exception
  888. */
  889. private void wtMonthYearlossesReal() throws Exception {
  890. List<PointData> resultList = new ArrayList<>();
  891. boolean firstDayOfMonth = DateUtils.isFirstDayOfMonth(currentDate);
  892. boolean firstDayOfYear = DateUtils.isFirstDayOfYear(currentDate);
  893. wtls.stream().forEach(wt->{
  894. Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
  895. //待机
  896. Windturbinetestingpointnew dayDjPoint = windturbinetestingpointnewMap.get(Contant.WTRDJSSDL);
  897. Windturbinetestingpointnew monthDjPoint = windturbinetestingpointnewMap.get(Contant.WTYDJSSDL);
  898. Windturbinetestingpointnew yearDjPoint = windturbinetestingpointnewMap.get(Contant.WTNDJSSDL);
  899. geneMonthOrYearLoss(resultList, dayDjPoint,monthDjPoint,firstDayOfMonth);
  900. geneMonthOrYearLoss(resultList, dayDjPoint,yearDjPoint,firstDayOfYear);
  901. //手动停机
  902. Windturbinetestingpointnew daySdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRSTSSDL);
  903. Windturbinetestingpointnew monthSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYSTSSDL);
  904. Windturbinetestingpointnew yearSdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNSTSSDL);
  905. geneMonthOrYearLoss(resultList, daySdtjPoint,monthSdtjPoint,firstDayOfMonth);
  906. geneMonthOrYearLoss(resultList, daySdtjPoint,yearSdtjPoint,firstDayOfYear);
  907. //性能
  908. Windturbinetestingpointnew dayXnPoint = windturbinetestingpointnewMap.get(Contant.WTRXNSSDL);
  909. Windturbinetestingpointnew monthXnPoint = windturbinetestingpointnewMap.get(Contant.WTYXNSSDL);
  910. Windturbinetestingpointnew yearXnPoint = windturbinetestingpointnewMap.get(Contant.WTNXNSSDL);
  911. geneMonthOrYearLoss(resultList, dayXnPoint,monthXnPoint,firstDayOfMonth);
  912. geneMonthOrYearLoss(resultList, dayXnPoint,yearXnPoint,firstDayOfYear);
  913. //发电降出力
  914. Windturbinetestingpointnew dayFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQXSSDL);
  915. Windturbinetestingpointnew monthFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQXSSDL);
  916. Windturbinetestingpointnew yearFdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQXSSDL);
  917. geneMonthOrYearLoss(resultList, dayFdjclPoint,monthFdjclPoint,firstDayOfMonth);
  918. geneMonthOrYearLoss(resultList, dayFdjclPoint,yearFdjclPoint,firstDayOfYear);
  919. //故障
  920. Windturbinetestingpointnew dayGzPoint = windturbinetestingpointnewMap.get(Contant.WTRGZSSDL);
  921. Windturbinetestingpointnew monthGzPoint = windturbinetestingpointnewMap.get(Contant.WTYGZSSDL);
  922. Windturbinetestingpointnew yearGzPoint = windturbinetestingpointnewMap.get(Contant.WTNGZSSDL);
  923. geneMonthOrYearLoss(resultList, dayGzPoint,monthGzPoint,firstDayOfMonth);
  924. geneMonthOrYearLoss(resultList, dayGzPoint,yearGzPoint,firstDayOfYear);
  925. //故障受累
  926. Windturbinetestingpointnew dayGzslPoint = windturbinetestingpointnewMap.get(Contant.WTRSZSSDL);
  927. Windturbinetestingpointnew monthGzslPoint = windturbinetestingpointnewMap.get(Contant.WTYSZSSDL);
  928. Windturbinetestingpointnew yearGzslPoint = windturbinetestingpointnewMap.get(Contant.WTNSZSSDL);
  929. geneMonthOrYearLoss(resultList, dayGzslPoint,monthGzslPoint,firstDayOfMonth);
  930. geneMonthOrYearLoss(resultList, dayGzslPoint,yearGzslPoint,firstDayOfYear);
  931. //维护
  932. Windturbinetestingpointnew dayWhPoint = windturbinetestingpointnewMap.get(Contant.WTRJXSSDL);
  933. Windturbinetestingpointnew monthWhPoint = windturbinetestingpointnewMap.get(Contant.WTYJXSSDL);
  934. Windturbinetestingpointnew yearWhPoint = windturbinetestingpointnewMap.get(Contant.WTNJXSSDL);
  935. geneMonthOrYearLoss(resultList, dayWhPoint,monthWhPoint,firstDayOfMonth);
  936. geneMonthOrYearLoss(resultList, dayWhPoint,yearWhPoint,firstDayOfYear);
  937. //维护受累
  938. Windturbinetestingpointnew dayWhslPoint = windturbinetestingpointnewMap.get(Contant.WTRLZSSDL);
  939. Windturbinetestingpointnew monthWhslPoint = windturbinetestingpointnewMap.get(Contant.WTYLZSSDL);
  940. Windturbinetestingpointnew yearWhslPoint = windturbinetestingpointnewMap.get(Contant.WTNLZSSDL);
  941. geneMonthOrYearLoss(resultList, dayWhslPoint,monthWhslPoint,firstDayOfMonth);
  942. geneMonthOrYearLoss(resultList, dayWhslPoint,yearWhslPoint,firstDayOfYear);
  943. //限电降出力
  944. Windturbinetestingpointnew dayXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTRQFSSDL);
  945. Windturbinetestingpointnew monthXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTYQFSSDL);
  946. Windturbinetestingpointnew yearXdjclPoint = windturbinetestingpointnewMap.get(Contant.WTNQFSSDL);
  947. geneMonthOrYearLoss(resultList, dayXdjclPoint,monthXdjclPoint,firstDayOfMonth);
  948. geneMonthOrYearLoss(resultList, dayXdjclPoint,yearXdjclPoint,firstDayOfYear);
  949. //限电停机
  950. Windturbinetestingpointnew dayXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTRXDSSDL);
  951. Windturbinetestingpointnew monthXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTYXDSSDL);
  952. Windturbinetestingpointnew yearXdtjPoint = windturbinetestingpointnewMap.get(Contant.WTNXDSSDL);
  953. geneMonthOrYearLoss(resultList, dayXdtjPoint,monthXdtjPoint,firstDayOfMonth);
  954. geneMonthOrYearLoss(resultList, dayXdtjPoint,yearXdtjPoint,firstDayOfYear);
  955. //电网受累
  956. Windturbinetestingpointnew dayDwslPoint = windturbinetestingpointnewMap.get(Contant.WTRWZSSDL);
  957. Windturbinetestingpointnew monthDwslPoint = windturbinetestingpointnewMap.get(Contant.WTYWZSSDL);
  958. Windturbinetestingpointnew yearDwslPoint = windturbinetestingpointnewMap.get(Contant.WTNWZSSDL);
  959. geneMonthOrYearLoss(resultList, dayDwslPoint,monthDwslPoint,firstDayOfMonth);
  960. geneMonthOrYearLoss(resultList, dayDwslPoint,yearDwslPoint,firstDayOfYear);
  961. //环境受累
  962. Windturbinetestingpointnew dayHjslPoint = windturbinetestingpointnewMap.get(Contant.WTRTZSSDL);
  963. Windturbinetestingpointnew monthHjslPoint = windturbinetestingpointnewMap.get(Contant.WTYTZSSDL);
  964. Windturbinetestingpointnew yearHjslPoint = windturbinetestingpointnewMap.get(Contant.WTNTZSSDL);
  965. geneMonthOrYearLoss(resultList, dayHjslPoint,monthHjslPoint,firstDayOfMonth);
  966. geneMonthOrYearLoss(resultList, dayHjslPoint,yearHjslPoint,firstDayOfYear);
  967. });
  968. edosUtil.sendMultiPoint(resultList);
  969. }
  970. private void geneMonthOrYearLoss(List<PointData> resultList,Windturbinetestingpointnew dayPoint,Windturbinetestingpointnew monthPoint,boolean firstDayOfMonthOrYear) {
  971. Double dayValue = 0.0;
  972. Double yestodayMonth = 0.0;
  973. try {
  974. if (!firstDayOfMonthOrYear){
  975. yestodayMonth = edosUtil.getSectionData(monthPoint, DateUtils.getYesterdayEnd().getTime()).getPointValueInDouble();
  976. }
  977. dayValue = edosUtil.getSectionData(dayPoint,tomorrow.getTime()).getPointValueInDouble();
  978. } catch (Exception e) {
  979. e.printStackTrace();
  980. }
  981. Double monthValue = dayValue + yestodayMonth;
  982. resultList.add(createWtPointData(monthPoint,monthValue));
  983. }
  984. private double generalLoss(List<PointData> ztmxDatasSnap, List<PointData> bzglDatasSnap, List<PointData> zsglDatasSnap, List<PointData> powerDatasSnap,Double statusValue,List<PointData> resultList,Windturbinetestingpointnew point) {
  985. List<PointData> pointDataList = ztmxDatasSnap.stream().filter(zt -> zt.getPointValueInDouble() == statusValue).collect(Collectors.toList());
  986. Double bzss = 0.0;
  987. Double zsss = 0.0;
  988. if (statusValue == 2.0 || statusValue == 3.0 || statusValue == 4.0){
  989. for(int i= 0;i<ztmxDatasSnap.size();i++){
  990. for (int j=0;j<pointDataList.size();j++){
  991. if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
  992. double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
  993. double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
  994. double power = powerDatasSnap.get(i).getPointValueInDouble();
  995. double temp = bzgl - power;
  996. if (temp>0){
  997. bzss+=temp;
  998. }
  999. double temp1 = zsgl - power;
  1000. if (temp1>0){
  1001. zsss+=temp1;
  1002. }
  1003. // bzss += (bzgl-power<0?0:bzgl-power);
  1004. // zsss += (zsgl-power<0?0:zsgl-power);
  1005. }
  1006. }
  1007. }
  1008. }else {
  1009. for(int i= 0;i<ztmxDatasSnap.size();i++){
  1010. for (int j=0;j<pointDataList.size();j++){
  1011. if (pointDataList.get(j).getPointTime().equals(ztmxDatasSnap.get(i).getPointTime())){
  1012. double bzgl = bzglDatasSnap.get(i).getPointValueInDouble();
  1013. double zsgl = zsglDatasSnap.get(i).getPointValueInDouble();
  1014. if (bzgl>0){
  1015. bzss+=bzgl;
  1016. }
  1017. if (zsgl>0){
  1018. zsss+=zsgl;
  1019. }
  1020. // bzss += bzgl<0?0:bzgl;
  1021. // zsss += zsgl<0?0:zsgl;
  1022. }
  1023. }
  1024. }
  1025. }
  1026. bzss = bzss /60>=0?bzss/60:0;
  1027. zsss = zsss/60>=0?zsss/60:0;
  1028. //待有历史改为用自算损失
  1029. PointData wtPointData = createWtPointData(point, zsss);
  1030. resultList.add(wtPointData);
  1031. return zsss;
  1032. }
  1033. private PointData createWtPointData(Windturbinetestingpointnew fjfdl, Double rfdl) {
  1034. PointData pointData = new PointData();
  1035. pointData.setEdnaId(fjfdl.getCode());
  1036. pointData.setPointName(fjfdl.getName());
  1037. pointData.setPointTime(currentDate.getTime());
  1038. pointData.setPointValueInDouble(rfdl);
  1039. pointData.setPointValue(String.valueOf(rfdl));
  1040. return pointData;
  1041. }
  1042. }