123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563 |
- package com.gyee.generation.service;
- import com.gyee.common.contant.Contant;
- import com.gyee.common.model.PointData;
- import com.gyee.common.util.DateUtils;
- import com.gyee.generation.init.CacheContext;
- import com.gyee.generation.model.auto.*;
- import com.gyee.generation.util.realtimesource.IEdosUtil;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.*;
- /**
- * @ClassName : AverageAndGeneratingService
- * @Author : xieshengjie
- * @Date: 2022/3/22 10:42
- * @Description : 平均风速,平均功率,SCADA发电量
- */
- @Service
- public class AverageAndGeneratingService {
- private Date samedayZero;
- private Date monthFirstZero;
- private Date yearFirstZero;
- private Date currentDate;
- private List<Windpowerstation> wpls;
- private Map<String, List<Project>> wppromap;
- private Map<String, List<Line>> prolinemap;
- private Map<String, List<Windturbine>> linewtmap;
- private Date tomorrow;
- private List<Windturbine> wtls;
- private Map<String, Map<String, Windpowerstationpointnew>> wppointmap;
- private Map<String, Map<String, Windpowerstationpointnew>> linepointmap;
- private Map<String, Map<String, Windpowerstationpointnew>> propointmap;
- private Map<String, Map<String, Windturbinetestingpointnew>> wtpAimap;
- @Resource
- private IEdosUtil edosUtil;
- @Value("${typeOfElectric.direct}")
- private String direct;
- private void init(){
- samedayZero = DateUtils.getSamedayZero();
- monthFirstZero = DateUtils.getMonthFirstZero();
- yearFirstZero = DateUtils.getYearFirstZero();
- currentDate = DateUtils.getCurrentDate();
- wpls = CacheContext.wpls;
- wtls = CacheContext.wtls;
- wppromap = CacheContext.wppromap;
- prolinemap = CacheContext.prolinemap;
- wppointmap = CacheContext.wppointmap;
- linepointmap = CacheContext.linepointmap;
- propointmap = CacheContext.propointmap;
- wtpAimap = CacheContext.wtpAimap;
- linewtmap = CacheContext.linewtmap;
- tomorrow = DateUtils.addDays(samedayZero,1);
- }
- /**
- * 保存最优功率,平均风速,平均功率,scada发电量,节能减排实时计算点
- * @throws Exception
- */
- public void saveAvespeedAndAvepowerAndScada() throws Exception {
- init();
- List<PointData> resultList = new ArrayList<>();
- String monthbenchPoints = Contant.monthbenchPoints;
- wpls.stream().forEach(wp->{
- List<Project> projects = wppromap.get(wp.getId());
- Map<String, Windpowerstationpointnew> wppointnewmap = wppointmap.get(wp.getId());
- Windpowerstationpointnew wpzyglpointnew = wppointnewmap.get(Contant.ZZYGL);
- Windpowerstationpointnew wppointnew = wppointnewmap.get(Contant.RPJFS);
- Windpowerstationpointnew ywppointnew = wppointnewmap.get(Contant.YPJFS);
- Windpowerstationpointnew nwppointnew = wppointnewmap.get(Contant.NPJFS);
- Windpowerstationpointnew powerwppointnew = wppointnewmap.get(Contant.RPJGL);
- Windpowerstationpointnew ypowerwppointnew = wppointnewmap.get(Contant.YPJGL);
- Windpowerstationpointnew npowerwppointnew = wppointnewmap.get(Contant.NPJGL);
- Windpowerstationpointnew fdlwppointnew = wppointnewmap.get(Contant.RFDL);
- Windpowerstationpointnew yfdlwppointnew = wppointnewmap.get(Contant.YFDL);
- Windpowerstationpointnew nfdlwppointnew = wppointnewmap.get(Contant.NFDL);
- Windpowerstationpointnew fnlylwppointnew = wppointnewmap.get(Contant.FNLYL);
- Windpowerstationpointnew jpeyhlwppointnew = wppointnewmap.get(Contant.JPEYHL);
- Windpowerstationpointnew jpeyhtwppointnew = wppointnewmap.get(Contant.JPEYHT);
- Windpowerstationpointnew jybmwppointnew = wppointnewmap.get(Contant.JYBM);
- Windpowerstationpointnew jyswppointnew = wppointnewmap.get(Contant.JYS);
- List<PointData> projectavespeedList = new ArrayList<>();
- List<PointData> yprojectavespeedList = new ArrayList<>();
- List<PointData> nprojectavespeedList = new ArrayList<>();
- List<PointData> projectzyglList = new ArrayList<>();
- List<PointData> projectavepowerList = new ArrayList<>();
- List<PointData> yprojectavepowerList = new ArrayList<>();
- List<PointData> nprojectavepowerList = new ArrayList<>();
- List<PointData> projectfdlList = new ArrayList<>();
- List<PointData> projectyfdlList = new ArrayList<>();
- List<PointData> projectnfdlList = new ArrayList<>();
- projects.stream().forEach(project -> {
- List<Line> lines = prolinemap.get(project.getId());
- Map<String, Windpowerstationpointnew> projectpointnewmap = propointmap.get(project.getId());
- Windpowerstationpointnew projectzyglpointnew = projectpointnewmap.get(Contant.ZZYGL);
- Windpowerstationpointnew projectpointnew = projectpointnewmap.get(Contant.RPJFS);
- Windpowerstationpointnew yprojectpointnew = projectpointnewmap.get(Contant.YPJFS);
- Windpowerstationpointnew nprojectpointnew = projectpointnewmap.get(Contant.NPJFS);
- Windpowerstationpointnew powerprojectpointnew = projectpointnewmap.get(Contant.RPJGL);
- Windpowerstationpointnew ypowerprojectpointnew = projectpointnewmap.get(Contant.YPJGL);
- Windpowerstationpointnew npowerprojectpointnew = projectpointnewmap.get(Contant.NPJGL);
- Windpowerstationpointnew fdlprojectpointnew = projectpointnewmap.get(Contant.RFDL);
- Windpowerstationpointnew yfdlprojectpointnew = projectpointnewmap.get(Contant.YFDL);
- Windpowerstationpointnew nfdlprojectpointnew = projectpointnewmap.get(Contant.NFDL);
- Windpowerstationpointnew fnlylprojectpointnew = projectpointnewmap.get(Contant.FNLYL);
- Windpowerstationpointnew jpeyhlprojectpointnew = projectpointnewmap.get(Contant.JPEYHL);
- Windpowerstationpointnew jpeyhtprojectpointnew = projectpointnewmap.get(Contant.JPEYHT);
- Windpowerstationpointnew jybmprojectpointnew = projectpointnewmap.get(Contant.JYBM);
- Windpowerstationpointnew jysprojectpointnew = projectpointnewmap.get(Contant.JYS);
- List<PointData> lineavespeedList = new ArrayList<>();
- List<PointData> ylineavespeedList = new ArrayList<>();
- List<PointData> nlineavespeedList = new ArrayList<>();
- List<PointData> lineavepowerList = new ArrayList<>();
- List<PointData> linezyglpowerList = new ArrayList<>();
- List<PointData> ylineavepowerList = new ArrayList<>();
- List<PointData> nlineavepowerList = new ArrayList<>();
- List<PointData> linefdlList = new ArrayList<>();
- List<PointData> ylinefdlList = new ArrayList<>();
- List<PointData> nlinefdlList = new ArrayList<>();
- lines.stream().forEach(line -> {
- List<Windturbine> windturbines = linewtmap.get(line.getId());
- Map<String, Windpowerstationpointnew> linepointnewmap = linepointmap.get(line.getId());
- Windpowerstationpointnew linezyglpointnew = linepointnewmap.get(Contant.ZZYGL);
- Windpowerstationpointnew linepointnew = linepointnewmap.get(Contant.RPJFS);
- Windpowerstationpointnew ylinepointnew = linepointnewmap.get(Contant.YPJFS);
- Windpowerstationpointnew nlinepointnew = linepointnewmap.get(Contant.NPJFS);
- Windpowerstationpointnew linepowerpointnew = linepointnewmap.get(Contant.RPJGL);
- Windpowerstationpointnew ylinepowerpointnew = linepointnewmap.get(Contant.YPJGL);
- Windpowerstationpointnew nlinepowerpointnew = linepointnewmap.get(Contant.NPJGL);
- Windpowerstationpointnew linefdlpointnew = linepointnewmap.get(Contant.RFDL);
- Windpowerstationpointnew ylinefdlpointnew = linepointnewmap.get(Contant.YFDL);
- Windpowerstationpointnew nlinefdlpointnew = linepointnewmap.get(Contant.NFDL);
- Windpowerstationpointnew linefnlylpointnew = linepointnewmap.get(Contant.FNLYL);
- Windpowerstationpointnew jpeyhlpointnew = linepointnewmap.get(Contant.JPEYHL);
- Windpowerstationpointnew jpeyhtpointnew = linepointnewmap.get(Contant.JPEYHT);
- Windpowerstationpointnew jybmpointnew = linepointnewmap.get(Contant.JYBM);
- Windpowerstationpointnew jyspointnew = linepointnewmap.get(Contant.JYS);
- List<PointData> wtzygldList = new ArrayList<>();
- List<PointData> wtavespeedList = new ArrayList<>();
- List<PointData> ywtavespeedList = new ArrayList<>();
- List<PointData> nwtavespeedList = new ArrayList<>();
- List<PointData> wtavepowerList = new ArrayList<>();
- List<PointData> ywtavepowerList = new ArrayList<>();
- List<PointData> nwtavepowerList = new ArrayList<>();
- List<PointData> rfdlList = new ArrayList<>();
- List<PointData> yfdlList = new ArrayList<>();
- List<PointData> nfdlList = new ArrayList<>();
- windturbines.stream().forEach(wt->{
- Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = wtpAimap.get(wt.getId());
- Windturbinetestingpointnew zyglPoint = windturbinetestingpointnewMap.get(Contant.ZZYGL);
- Windturbinetestingpointnew aveSpeedPoint = windturbinetestingpointnewMap.get(Contant.RPJFS);
- Windturbinetestingpointnew monthAveSpeedPoint = windturbinetestingpointnewMap.get(Contant.YPJFS);
- Windturbinetestingpointnew yearAveSpeedPoint = windturbinetestingpointnewMap.get(Contant.NPJFS);
- Windturbinetestingpointnew fjssfs = windturbinetestingpointnewMap.get(Contant.AI022);
- Windturbinetestingpointnew avePowerPoint = windturbinetestingpointnewMap.get(Contant.RPJGL);
- Windturbinetestingpointnew yavePowerPoint = windturbinetestingpointnewMap.get(Contant.YPJGL);
- Windturbinetestingpointnew navePowerPoint = windturbinetestingpointnewMap.get(Contant.NPJGL);
- Windturbinetestingpointnew fjssgl = windturbinetestingpointnewMap.get(Contant.AI130);
- Windturbinetestingpointnew ai064 = windturbinetestingpointnewMap.get(Contant.AI064);
- Windturbinetestingpointnew fjfdl = windturbinetestingpointnewMap.get(Contant.RFDL);
- Windturbinetestingpointnew fjyfdl = windturbinetestingpointnewMap.get(Contant.YFDL);
- Windturbinetestingpointnew fjnfdl = windturbinetestingpointnewMap.get(Contant.NFDL);
- Windturbinetestingpointnew ai138 = windturbinetestingpointnewMap.get(Contant.AI138);
- Windturbinetestingpointnew ai139 = windturbinetestingpointnewMap.get(Contant.AI139);
- try {
- //算发电量
- Double rfdl = 0.0;
- Double yfdl = 0.0;
- Double nfdl = 0.0;
- if (direct.contains(wt.getProjectid())){
- rfdl = edosUtil.getSectionData(ai064,tomorrow.getTime()).getPointValueInDouble();
- yfdl = edosUtil.getSectionData(ai138,tomorrow.getTime()).getPointValueInDouble();
- nfdl = edosUtil.getSectionData(ai139,tomorrow.getTime()).getPointValueInDouble();
- }else{
- Double currentValue = 0.0;
- Double samedayValue = 0.0;
- Double monthFirstValue = 0.0;
- Double yearFirstValue = 0.0;
- PointData realData = edosUtil.getSectionData(ai064,tomorrow.getTime());
- currentValue = realData.getPointValueInDouble();
- samedayValue = edosUtil.getSectionData(ai064,samedayZero.getTime()).getPointValueInDouble();
- monthFirstValue = edosUtil.getSectionData(ai064,monthFirstZero.getTime()).getPointValueInDouble();
- yearFirstValue = edosUtil.getSectionData(ai064,yearFirstZero.getTime()).getPointValueInDouble();
- rfdl = currentValue - samedayValue;
- yfdl = currentValue - monthFirstValue;
- nfdl = currentValue - yearFirstValue;
- }
- PointData fdlpointData = createPointData(fjfdl, rfdl);
- rfdlList.add(fdlpointData);
- PointData yfdlpointData = createPointData(fjyfdl, yfdl);
- yfdlList.add(yfdlpointData);
- PointData nfdlpointData = createPointData(fjnfdl, nfdl);
- yfdlList.add(nfdlpointData);
- //算平均风速
- List<PointData> ssfsList = edosUtil.getHistStat(fjssfs, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> ssfsFirst = ssfsList.stream().findFirst();
- if (ssfsFirst.isPresent()){
- PointData pointData = ssfsFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(aveSpeedPoint, pointData, inDouble);
- wtavespeedList.add(pointData);
- }
- //算月平均风速
- List<PointData> yssfsList = edosUtil.getHistStat(fjssfs, monthFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> yssfsFirst = yssfsList.stream().findFirst();
- if (yssfsFirst.isPresent()){
- PointData pointData = yssfsFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(monthAveSpeedPoint, pointData, inDouble);
- ywtavespeedList.add(pointData);
- }
- //算年平均风速
- List<PointData> nssfsList = edosUtil.getHistStat(fjssfs, yearFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> nssfsFirst = nssfsList.stream().findFirst();
- if (nssfsFirst.isPresent()){
- PointData pointData = nssfsFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(yearAveSpeedPoint, pointData, inDouble);
- nwtavespeedList.add(pointData);
- }
- //算平均功率
- List<PointData> ssglList = edosUtil.getHistStat(fjssgl, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> ssglFirst = ssglList.stream().findFirst();
- if (ssglFirst.isPresent()){
- PointData pointData = ssglFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(avePowerPoint, pointData, inDouble);
- wtavepowerList.add(pointData);
- }
- //算最优功率
- List<PointData> zyglList = edosUtil.getHistStat(fjssgl, samedayZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 0);
- Optional<PointData> zyglFirst = zyglList.stream().findFirst();
- if (zyglFirst.isPresent()){
- PointData pointData = zyglFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(zyglPoint, pointData, inDouble);
- wtzygldList.add(pointData);
- }
- //算月平均功率
- List<PointData> yssglList = edosUtil.getHistStat(fjssgl, monthFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> yssglFirst = yssglList.stream().findFirst();
- if (yssglFirst.isPresent()){
- PointData pointData = yssglFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(yavePowerPoint, pointData, inDouble);
- ywtavepowerList.add(pointData);
- }
- //算年平均功率
- List<PointData> nssglList = edosUtil.getHistStat(fjssgl, yearFirstZero.getTime() / 1000, currentDate.getTime() / 1000, 1l, null, 2);
- Optional<PointData> nssglFirst = nssglList.stream().findFirst();
- if (nssglFirst.isPresent()){
- PointData pointData = nssglFirst.get();
- double inDouble = pointData.getPointValueInDouble();
- createWtPointData(navePowerPoint, pointData, inDouble);
- nwtavepowerList.add(pointData);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- });
- resultList.addAll(wtavespeedList);
- resultList.addAll(ywtavespeedList);
- resultList.addAll(nwtavespeedList);
- resultList.addAll(wtavepowerList);
- resultList.addAll(wtzygldList);
- resultList.addAll(ywtavepowerList);
- resultList.addAll(nwtavepowerList);
- resultList.addAll(rfdlList);
- resultList.addAll(yfdlList);
- resultList.addAll(nfdlList);
- double linefdl = rfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- double lineyfdl = yfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- double linenfdl = nfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData fdlpoint = createWpPointData(linefdlpointnew, linefdl);
- PointData yfdlpoint = createWpPointData(ylinefdlpointnew, lineyfdl);
- PointData nfdlpoint = createWpPointData(nlinefdlpointnew, linenfdl);
- linefdlList.add(fdlpoint);
- ylinefdlList.add(yfdlpoint);
- nlinefdlList.add(nfdlpoint);
- //算节能减排
- double jpeyhl = lineyfdl * 0.0059;
- double jpeyht = lineyfdl * 0.8568;
- double jybm = lineyfdl * 0.37;
- double jys = lineyfdl * 3.05;
- PointData jpeyhlpoint = createWpPointData(jpeyhlpointnew, jpeyhl);
- PointData jpeyhtpoint = createWpPointData(jpeyhtpointnew, jpeyht);
- PointData jybmpoint = createWpPointData(jybmpointnew, jybm);
- PointData jyspoint = createWpPointData(jyspointnew, jys);
- resultList.add(jpeyhlpoint);
- resultList.add(jpeyhtpoint);
- resultList.add(jybmpoint);
- resultList.add(jyspoint);
- //算风能利用率
- List<String> pointList = new ArrayList<>();
- double ssdl = 0;
- Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
- pointList.add(linepointnewmap.get(code).getCode());
- });
- try {
- List<PointData> ssdlList = edosUtil.getRealData(pointList);
- ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- } catch (Exception e) {
- e.printStackTrace();
- }
- double fnlyl = (ssdl+lineyfdl)!=0?lineyfdl/(ssdl+lineyfdl)*100:0;
- PointData fnlylpoint = createWpPointData(linefnlylpointnew, fnlyl);
- resultList.add(fnlylpoint);
- OptionalDouble average = wtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- if (average.isPresent()){
- double linespeed = average.getAsDouble();
- PointData pointData = createWpPointData(linepointnew, linespeed);
- lineavespeedList.add(pointData);
- }
- OptionalDouble yaverage = ywtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- if (yaverage.isPresent()){
- double linespeed = yaverage.getAsDouble();
- PointData pointData = createWpPointData(ylinepointnew, linespeed);
- ylineavespeedList.add(pointData);
- }
- OptionalDouble naverage = nwtavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- if (naverage.isPresent()){
- double linespeed = naverage.getAsDouble();
- PointData pointData = createWpPointData(nlinepointnew, linespeed);
- nlineavespeedList.add(pointData);
- }
- Double poweraverage = wtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData powerpointData = createWpPointData(linepowerpointnew, poweraverage);
- lineavepowerList.add(powerpointData);
- Double zyglrage = wtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData zyglpointData = createWpPointData(linezyglpointnew, zyglrage);
- linezyglpowerList.add(zyglpointData);
- Double ypoweraverage = ywtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData ypowerpointData = createWpPointData(ylinepowerpointnew, ypoweraverage);
- ylineavepowerList.add(ypowerpointData);
- Double npoweraverage = nwtavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData npowerpointData = createWpPointData(nlinepowerpointnew, npoweraverage);
- nlineavepowerList.add(npowerpointData);
- });
- OptionalDouble average = lineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- OptionalDouble yaverage = ylineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- OptionalDouble naverage = nlineavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- Double prorfdl = linefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- Double proyfdl = ylinefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- Double pronfdl = nlinefdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- resultList.addAll(lineavespeedList);
- resultList.addAll(ylineavespeedList);
- resultList.addAll(nlineavespeedList);
- resultList.addAll(lineavepowerList);
- resultList.addAll(ylineavepowerList);
- resultList.addAll(nlineavepowerList);
- resultList.addAll(linefdlList);
- resultList.addAll(ylinefdlList);
- resultList.addAll(nlinefdlList);
- resultList.addAll(linezyglpowerList);
- //算节能减排
- double jpeyhl = proyfdl * 0.0059;
- double jpeyht = proyfdl * 0.8568;
- double jybm = proyfdl * 0.37;
- double jys = proyfdl * 3.05;
- PointData jpeyhlpoint = createWpPointData(jpeyhlprojectpointnew, jpeyhl);
- PointData jpeyhtpoint = createWpPointData(jpeyhtprojectpointnew, jpeyht);
- PointData jybmpoint = createWpPointData(jybmprojectpointnew, jybm);
- PointData jyspoint = createWpPointData(jysprojectpointnew, jys);
- resultList.add(jpeyhlpoint);
- resultList.add(jpeyhtpoint);
- resultList.add(jybmpoint);
- resultList.add(jyspoint);
- //算风能利用率
- List<String> pointList = new ArrayList<>();
- double ssdl = 0;
- Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
- pointList.add(projectpointnewmap.get(code).getCode());
- });
- try {
- List<PointData> ssdlList = edosUtil.getRealData(pointList);
- ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- } catch (Exception e) {
- e.printStackTrace();
- }
- double fnlyl = (ssdl+proyfdl)!=0?proyfdl/(ssdl+proyfdl)*100:0;
- PointData fnlylpoint = createWpPointData(fnlylprojectpointnew, fnlyl);
- resultList.add(fnlylpoint);
- PointData rfdlpointData = createWpPointData(fdlprojectpointnew, prorfdl);
- PointData yfdlpointData = createWpPointData(yfdlprojectpointnew, proyfdl);
- PointData nfdlpointData = createWpPointData(nfdlprojectpointnew, pronfdl);
- projectfdlList.add(rfdlpointData);
- projectyfdlList.add(yfdlpointData);
- projectnfdlList.add(nfdlpointData);
- if (average.isPresent()){
- double projectspeed = average.getAsDouble();
- PointData pointData = createWpPointData(projectpointnew, projectspeed);
- projectavespeedList.add(pointData);
- }
- if (yaverage.isPresent()){
- double projectspeed = yaverage.getAsDouble();
- PointData pointData = createWpPointData(yprojectpointnew, projectspeed);
- yprojectavespeedList.add(pointData);
- }
- if (naverage.isPresent()){
- double projectspeed = naverage.getAsDouble();
- PointData pointData = createWpPointData(nprojectpointnew, projectspeed);
- nprojectavespeedList.add(pointData);
- }
- Double zyglaverage = linezyglpowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- Double poweraverage = lineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- Double ypoweraverage = ylineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- Double npoweraverage = nlineavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData zyglpointData = createWpPointData(projectzyglpointnew, zyglaverage);
- projectzyglList.add(zyglpointData);
- PointData powerpointData = createWpPointData(powerprojectpointnew, poweraverage);
- projectavepowerList.add(powerpointData);
- PointData ypowerpointData = createWpPointData(ypowerprojectpointnew, ypoweraverage);
- yprojectavepowerList.add(ypowerpointData);
- PointData npowerpointData = createWpPointData(npowerprojectpointnew, npoweraverage);
- nprojectavepowerList.add(npowerpointData);
- });
- resultList.addAll(projectfdlList);
- resultList.addAll(projectyfdlList);
- resultList.addAll(projectnfdlList);
- double fcrfdl = projectfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData fdlpointData = createWpPointData(fdlwppointnew, fcrfdl);
- resultList.add(fdlpointData);
- double fcyfdl = projectyfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData yfdlpointData = createWpPointData(yfdlwppointnew, fcyfdl);
- resultList.add(yfdlpointData);
- //算节能减排
- double jpeyhl = fcyfdl * 0.0059;
- double jpeyht = fcyfdl * 0.8568;
- double jybm = fcyfdl * 0.37;
- double jys = fcyfdl * 3.05;
- PointData jpeyhlpoint = createWpPointData(jpeyhlwppointnew, jpeyhl);
- PointData jpeyhtpoint = createWpPointData(jpeyhtwppointnew, jpeyht);
- PointData jybmpoint = createWpPointData(jybmwppointnew, jybm);
- PointData jyspoint = createWpPointData(jyswppointnew, jys);
- resultList.add(jpeyhlpoint);
- resultList.add(jpeyhtpoint);
- resultList.add(jybmpoint);
- resultList.add(jyspoint);
- //算风能利用率
- List<String> pointList = new ArrayList<>();
- double ssdl = 0;
- Arrays.stream(monthbenchPoints.split(",")).forEach(code->{
- pointList.add(wppointnewmap.get(code).getCode());
- });
- try {
- List<PointData> ssdlList = edosUtil.getRealData(pointList);
- ssdl = ssdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- } catch (Exception e) {
- e.printStackTrace();
- }
- double fnlyl = (ssdl+fcyfdl)!=0?fcyfdl/(ssdl+fcyfdl)*100:0;
- PointData fnlylpoint = createWpPointData(fnlylwppointnew, fnlyl);
- resultList.add(fnlylpoint);
- double fcnfdl = projectnfdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- PointData nfdlpointData = createWpPointData(nfdlwppointnew, fcnfdl);
- resultList.add(nfdlpointData);
- OptionalDouble average = projectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- resultList.addAll(projectavespeedList);
- if (average.isPresent()){
- double wpspeed = average.getAsDouble();
- PointData pointData = createWpPointData(wppointnew, wpspeed);
- resultList.add(pointData);
- }
- OptionalDouble yaverage = yprojectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- resultList.addAll(yprojectavespeedList);
- if (yaverage.isPresent()){
- double wpspeed = yaverage.getAsDouble();
- PointData pointData = createWpPointData(ywppointnew, wpspeed);
- resultList.add(pointData);
- }
- OptionalDouble naverage = nprojectavespeedList.stream().mapToDouble(PointData::getPointValueInDouble).average();
- resultList.addAll(nprojectavespeedList);
- if (naverage.isPresent()){
- double wpspeed = naverage.getAsDouble();
- PointData pointData = createWpPointData(nwppointnew, wpspeed);
- resultList.add(pointData);
- }
- Double poweraverage = projectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- resultList.addAll(projectavepowerList);
- PointData powerpointData = createWpPointData(powerwppointnew, poweraverage);
- resultList.add(powerpointData);
- Double zyglaverage = projectzyglList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- resultList.addAll(projectzyglList);
- PointData zyglpointData = createWpPointData(wpzyglpointnew, zyglaverage);
- resultList.add(zyglpointData);
- Double ypoweraverage = yprojectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- resultList.addAll(yprojectavepowerList);
- PointData ypowerpointData = createWpPointData(ypowerwppointnew, ypoweraverage);
- resultList.add(ypowerpointData);
- Double npoweraverage = nprojectavepowerList.stream().mapToDouble(PointData::getPointValueInDouble).sum();
- resultList.addAll(nprojectavepowerList);
- PointData npowerpointData = createWpPointData(npowerwppointnew, npoweraverage);
- resultList.add(npowerpointData);
- });
- edosUtil.sendMultiPoint(resultList);
- }
- private PointData createPointData(Windturbinetestingpointnew fjfdl, Double rfdl) {
- PointData pointData = new PointData();
- pointData.setEdnaId(fjfdl.getCode());
- pointData.setPointName(fjfdl.getName());
- pointData.setPointTime(currentDate.getTime());
- pointData.setPointValueInDouble(rfdl);
- pointData.setPointValue(String.valueOf(rfdl));
- return pointData;
- }
- private PointData createWpPointData(Windpowerstationpointnew linepointnew, double linespeed) {
- PointData pointData = new PointData();
- pointData.setEdnaId(linepointnew.getCode());
- pointData.setPointTime(currentDate.getTime());
- pointData.setPointName(linepointnew.getName());
- pointData.setPointValue(String.valueOf(linespeed));
- pointData.setPointValueInDouble(linespeed);
- return pointData;
- }
- private void createWtPointData(Windturbinetestingpointnew aveSpeedPoint, PointData pointData, double inDouble) {
- pointData.setEdnaId(aveSpeedPoint.getCode());
- pointData.setPointName(aveSpeedPoint.getName());
- pointData.setPointValueInDouble(inDouble);
- pointData.setPointValue(String.valueOf(inDouble));
- pointData.setPointTime(currentDate.getTime());
- }
- }
|