Compare commits
5 Commits
e6c3164bb0
...
ff059150fd
Author | SHA1 | Date |
---|---|---|
|
ff059150fd | 1 year ago |
|
d47245ab74 | 1 year ago |
|
470756724a | 1 year ago |
|
a253c3a9c3 | 1 year ago |
|
2725199dd2 | 1 year ago |
@ -0,0 +1,24 @@ |
||||
package com.dky.calculate; |
||||
//方案优势
|
||||
public class BuildHeatingAdvantage { |
||||
//安全性
|
||||
public static String safety(){ |
||||
return "精准控温"; |
||||
} |
||||
//经济性
|
||||
public static String economy(Double firstInvestFee,Double yearTotalFee,Double yearRunFee,Double lastYearFee){ |
||||
Double hsq = Math.round(firstInvestFee/yearTotalFee*100.0)/100.0; |
||||
double js = Math.round((lastYearFee - yearRunFee)*100.0)/100.0; |
||||
return "本次改造投资回收期为"+hsq+"年,本改造方案相比较原技术节省年运行费用成本"+js+"元。"; |
||||
} |
||||
// 智能性
|
||||
public static String intelligence() { |
||||
return "以电锅炉替代和实现精准控温。"; |
||||
} |
||||
|
||||
// 环保性
|
||||
public static String environment(Double yearReduceCarbon) { |
||||
return "本次改造方案减排" + yearReduceCarbon + "吨"; |
||||
} |
||||
|
||||
} |
@ -1,13 +1,54 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
|
||||
import com.dky.utils.result.MatchedDevice; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public class CalC { |
||||
//投入供热设备总功率计算
|
||||
public double calTotalPower(List<MatchedDevice> matchedDevices,Double buildArea) { |
||||
|
||||
return floor * heatArea * devPrice; |
||||
public static List<Map<String, Double>> getC(List<Map<String, List<List<MatchedDevice>>>> list) { |
||||
List<Map<String, Double>> maps = new ArrayList<>(); |
||||
list.parallelStream().forEach(stringListMap -> { |
||||
// 区分热泵、电锅炉
|
||||
stringListMap.forEach((k,v)->{ |
||||
// 循环遍历各个方案
|
||||
final Double[] maxPower = {0.0}; |
||||
v.parallelStream().forEach((plan)->{ |
||||
Double power = 0.0; |
||||
for (MatchedDevice device : plan){ |
||||
power = power + (device.getCount() * device.getDeviceHeatScene().getDevPower()) ; |
||||
} |
||||
if (power >= maxPower[0]){ |
||||
maxPower[0] = power; |
||||
} |
||||
}); |
||||
Map<String, Double> map = new HashMap<>(); |
||||
map.put(k, maxPower[0]); |
||||
maps.add(map); |
||||
}); |
||||
}); |
||||
return maps; |
||||
} |
||||
|
||||
public static Double getC1(List<List<MatchedDevice>> args) { |
||||
// 循环遍历各个方案
|
||||
final Double[] maxPower = {-100.0}; |
||||
args.parallelStream().forEach(plan -> { |
||||
Double power = 0.0; |
||||
for (MatchedDevice device : plan){ |
||||
power = power + (device.getCount() * device.getDeviceHeatScene().getDevPower()) ; |
||||
} |
||||
if (power >= maxPower[0]){ |
||||
maxPower[0] = power; |
||||
} |
||||
}); |
||||
return maxPower[0]; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
@ -0,0 +1,30 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public class CalD { |
||||
|
||||
/** |
||||
* 改造后最大需量 |
||||
* @param lastYearNeed 上年最大需量 |
||||
* @param list 设备总功率集合 |
||||
*/ |
||||
public static List<Map> getD(Double lastYearNeed, List<Map<String, Double>> list) { |
||||
List<Map> maps = new ArrayList<>(); |
||||
list.parallelStream().forEach((s)->{ |
||||
Map<String, Double> map = new HashMap<>(); |
||||
s.forEach((k,v)->{ |
||||
map.put(k, lastYearNeed + v); |
||||
maps.add(map); |
||||
}); |
||||
}); |
||||
return maps; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,149 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import com.dky.utils.entity.SysDeviceHeatScene; |
||||
import com.dky.utils.result.MatchedDevice; |
||||
|
||||
import java.util.*; |
||||
import java.util.concurrent.atomic.AtomicReference; |
||||
|
||||
public class SchemeRating { |
||||
|
||||
/** |
||||
* 计算每一种方案的效率和成本评分 |
||||
* @param list |
||||
* @return |
||||
*/ |
||||
public static Map<String, SchemeRatingRes> getOptimalList(List<List<MatchedDevice>> list,Double costRatio,Double effRatio,Map<String,Double> maxEff,Map<String, Double> minPrice) { |
||||
|
||||
Map<String, SchemeRatingRes> optimalMap = new HashMap<>(); |
||||
list.forEach(plan->{ |
||||
String devTechType = plan.get(0).getDeviceHeatScene().getDevTechType(); |
||||
AtomicReference<Double> rating = new AtomicReference<>(0.0); |
||||
String devSubType = plan.get(0).getDeviceHeatScene().getDevSubType(); |
||||
Double eff = 0.0; |
||||
Double cost = 0.0; |
||||
for (MatchedDevice device : plan) { |
||||
eff = device.getDeviceHeatScene().getHeatEfficiency(); |
||||
} |
||||
for (MatchedDevice device : plan) { |
||||
cost = cost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife()); |
||||
} |
||||
|
||||
double v1 = (maxEff.get(devSubType) - eff) / maxEff.get(devSubType); // 热效率占比计算
|
||||
double v = (cost - minPrice.get(devSubType)) / minPrice.get(devSubType); // 成本占比计算
|
||||
System.out.println("当前方案成本: " + cost + ",当前方案热效率: " + eff + ",技术选型: " + devSubType + ",最小成本Map: " + minPrice + ",最大热效率Map: " + maxEff); |
||||
// System.out.println("成本除法运算 = " + v + ",减法运算 = " + (1 - v) + ",乘法运算 = " + (1 -v) * 20 + "。");
|
||||
// System.out.println("热效率除法运算 = " + v1 + ",减法运算 = " + (1 - v1) + ",乘法运算 = " + (1 -v1) * 80 + "。\n");
|
||||
// 3、(1-(选择对应设备细类的效率最大的效率值(效率最大值)-当前设备的效率值值)/效率最大值)*100*系数 +(1-(当前成本值-对应设备细类的成本最小值)/对应设备细类的成本最小值)*100*0.2。取最高得分。
|
||||
rating.set(((1 - v1) * 100 * effRatio) + ((1 - v) * 100 * costRatio)); |
||||
// 方案评分结果
|
||||
SchemeRatingRes schemeRatingRes = new SchemeRatingRes(plan, rating.get(), devTechType); |
||||
optimalMap.put(devTechType, schemeRatingRes); |
||||
|
||||
System.out.println("方案详情 = "); |
||||
for (MatchedDevice matchedDevice : plan){ |
||||
System.out.println(matchedDevice); |
||||
} |
||||
System.out.println("当前方案评分: " + rating.get() + "\n"); |
||||
}); |
||||
return optimalMap; |
||||
} |
||||
|
||||
/** |
||||
* 获取最优评分的方案 |
||||
* @param map |
||||
* @return |
||||
*/ |
||||
public static List<MatchedDevice> getOptimalScheme(Map<String, SchemeRatingRes> map) { |
||||
|
||||
final AtomicReference<Double>[] rating = new AtomicReference[]{new AtomicReference<>(-100.0)}; |
||||
final List<MatchedDevice>[] list = new List[]{new ArrayList<>()}; |
||||
map.forEach((k,v)->{ |
||||
if (v.getSchemeRating() > rating[0].get()) { |
||||
rating[0].set(v.getSchemeRating()); |
||||
list[0] = v.getList(); |
||||
} |
||||
}); |
||||
|
||||
return list[0]; |
||||
} |
||||
|
||||
/** |
||||
* 获取不同设备细类下的效率最大值 |
||||
* @param alternateDeviceList 可替代设备列表 |
||||
* @return 不同设备细类下的效率最大值map |
||||
*/ |
||||
public static Map<String,Double> getMaxEfficiencyGroupByDevSubType( List<SysDeviceHeatScene> alternateDeviceList){ |
||||
Map<String,Double> map = new HashMap<>(); |
||||
alternateDeviceList.forEach(alternateDevice ->{ |
||||
String devSubType = alternateDevice.getDevSubType(); |
||||
Double v = map.get(devSubType); |
||||
if ( v == null){ |
||||
map.put(devSubType,alternateDevice.getHeatEfficiency()); |
||||
} else { |
||||
if( alternateDevice.getHeatEfficiency() > v){ |
||||
map.put(devSubType,alternateDevice.getHeatEfficiency()); |
||||
} |
||||
} |
||||
}); |
||||
return map; |
||||
} |
||||
|
||||
/** |
||||
* 获取不同设备细类下的成本最小值 |
||||
* @param alternateDeviceList 可替代设备列表 |
||||
* @return 不同设备细类下的成本最小值 |
||||
*/ |
||||
public static Map<String,Double> getMinPriceGroupByDevSubType(List<List<MatchedDevice>> alternateDeviceList){ |
||||
Map<String,Double> map = new HashMap<>(); |
||||
alternateDeviceList.forEach(plan -> { |
||||
Double thisPlanCost = 0.0; |
||||
String devSubType = plan.get(0).getDeviceHeatScene().getDevSubType(); |
||||
for (MatchedDevice device : plan) { |
||||
thisPlanCost = thisPlanCost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife()); |
||||
} |
||||
|
||||
Double v = map.get(devSubType); |
||||
if ( v == null){ |
||||
map.put(devSubType, thisPlanCost); |
||||
} else { |
||||
if(thisPlanCost < v){ |
||||
map.put(devSubType, thisPlanCost); |
||||
} |
||||
} |
||||
}); |
||||
return map; |
||||
} |
||||
|
||||
|
||||
public static List<Map<String, Double[]>> getIndex(List<List<MatchedDevice>> list) { |
||||
List<Map<String, Double[]>> maps = new ArrayList<>(); |
||||
final Double[] index = {0.0, Double.MAX_VALUE}; |
||||
Map<String, Double[]> map = new HashMap<>(); |
||||
|
||||
list.parallelStream().forEach((plan) -> { |
||||
Double eff = 0.0; |
||||
Double cost = 0.0; |
||||
for (MatchedDevice device : plan) { |
||||
eff = device.getDeviceHeatScene().getHeatEfficiency(); |
||||
} |
||||
for (MatchedDevice device : plan) { |
||||
cost = cost + ((device.getCount() * device.getDeviceHeatScene().getDevPrice()) + (device.getCount()) * device.getDeviceHeatScene().getDevSubstituteLaborCost() * device.getDeviceHeatScene().getDevServiceLife()); |
||||
} |
||||
if (eff >= index[0]) { |
||||
index[0] = eff; |
||||
} |
||||
if (cost <= index[1]) { |
||||
index[1] = cost; |
||||
} |
||||
map.put(plan.get(0).getDeviceHeatScene().getDevSubType(), index); |
||||
maps.add(map); |
||||
}); |
||||
return maps; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
import com.dky.utils.result.MatchedDevice; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class SchemeRatingRes { |
||||
|
||||
List<MatchedDevice> list; |
||||
|
||||
Double schemeRating; |
||||
|
||||
String planName; |
||||
|
||||
public SchemeRatingRes() { } |
||||
|
||||
public SchemeRatingRes(List<MatchedDevice> list, Double schemeRating, String planName) { |
||||
this.list = list; |
||||
this.schemeRating = schemeRating; |
||||
this.planName = planName; |
||||
} |
||||
|
||||
public List<MatchedDevice> getList() { |
||||
return list; |
||||
} |
||||
|
||||
public void setList(List<MatchedDevice> list) { |
||||
this.list = list; |
||||
} |
||||
|
||||
public Double getSchemeRating() { |
||||
return schemeRating; |
||||
} |
||||
|
||||
public void setSchemeRating(Double schemeRating) { |
||||
this.schemeRating = schemeRating; |
||||
} |
||||
|
||||
public String getPlanName() { |
||||
return planName; |
||||
} |
||||
|
||||
public void setPlanName(String planName) { |
||||
this.planName = planName; |
||||
} |
||||
} |
@ -1,27 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class Construction { |
||||
|
||||
// 建筑类型(1机关,2医院,3学校,4商业办公楼,5酒店,6其他)
|
||||
private Integer constrType; |
||||
|
||||
// 建筑面积(平方米)
|
||||
private Double floor; |
||||
|
||||
public Integer getConstrType() { |
||||
return constrType; |
||||
} |
||||
|
||||
public void setConstrType(Integer constrType) { |
||||
this.constrType = constrType; |
||||
} |
||||
|
||||
public Double getFloor() { |
||||
return floor; |
||||
} |
||||
|
||||
public void setFloor(Double floor) { |
||||
this.floor = floor; |
||||
} |
||||
} |
@ -1,147 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class CoolHeat { |
||||
|
||||
// 年采暖时间(天)
|
||||
private Integer yearGetHeatDays; |
||||
|
||||
// 是否有蒸汽/生活热水需求(1是,2否)
|
||||
private Integer isHeatWater; |
||||
|
||||
// 每小时最大需求量(吨蒸汽)
|
||||
private Double hourMaxXqlDZQ; |
||||
|
||||
// 每小时最大需求量(吨热水)
|
||||
private Double hourMaxXqlDRS; |
||||
|
||||
// 是否有供冷需求(1是,2否)
|
||||
private Integer isCool; |
||||
|
||||
// 年供冷时间(天)
|
||||
private Integer yearGetCoolDays; |
||||
|
||||
// 末端形式(1风机盘管,2地暖,3暖气片,4无末端)
|
||||
private Integer endForm; |
||||
|
||||
// 单台电锅炉的需求功率
|
||||
private Double needPower; |
||||
|
||||
// 单台电设备参考的可供暖面积
|
||||
private Double heatArea; |
||||
|
||||
// 单台电设备价格
|
||||
private Double devPrice; |
||||
|
||||
// 电替代设备人工费用成本
|
||||
private Double laborCost; |
||||
|
||||
// 电锅炉的使用年限
|
||||
private Integer useYears; |
||||
|
||||
private OriginalDevice originalDevice; |
||||
|
||||
public Integer getYearGetHeatDays() { |
||||
return yearGetHeatDays; |
||||
} |
||||
|
||||
public void setYearGetHeatDays(Integer yearGetHeatDays) { |
||||
this.yearGetHeatDays = yearGetHeatDays; |
||||
} |
||||
|
||||
public Integer getIsHeatWater() { |
||||
return isHeatWater; |
||||
} |
||||
|
||||
public void setIsHeatWater(Integer isHeatWater) { |
||||
this.isHeatWater = isHeatWater; |
||||
} |
||||
|
||||
public Double getHourMaxXqlDZQ() { |
||||
return hourMaxXqlDZQ; |
||||
} |
||||
|
||||
public void setHourMaxXqlDZQ(Double hourMaxXqlDZQ) { |
||||
this.hourMaxXqlDZQ = hourMaxXqlDZQ; |
||||
} |
||||
|
||||
public Double getHourMaxXqlDRS() { |
||||
return hourMaxXqlDRS; |
||||
} |
||||
|
||||
public void setHourMaxXqlDRS(Double hourMaxXqlDRS) { |
||||
this.hourMaxXqlDRS = hourMaxXqlDRS; |
||||
} |
||||
|
||||
public Integer getIsCool() { |
||||
return isCool; |
||||
} |
||||
|
||||
public void setIsCool(Integer isCool) { |
||||
this.isCool = isCool; |
||||
} |
||||
|
||||
public Integer getYearGetCoolDays() { |
||||
return yearGetCoolDays; |
||||
} |
||||
|
||||
public void setYearGetCoolDays(Integer yearGetCoolDays) { |
||||
this.yearGetCoolDays = yearGetCoolDays; |
||||
} |
||||
|
||||
public Integer getEndForm() { |
||||
return endForm; |
||||
} |
||||
|
||||
public void setEndForm(Integer endForm) { |
||||
this.endForm = endForm; |
||||
} |
||||
|
||||
public Double getNeedPower() { |
||||
return needPower; |
||||
} |
||||
|
||||
public void setNeedPower(Double needPower) { |
||||
this.needPower = needPower; |
||||
} |
||||
|
||||
public Double getHeatArea() { |
||||
return heatArea; |
||||
} |
||||
|
||||
public void setHeatArea(Double heatArea) { |
||||
this.heatArea = heatArea; |
||||
} |
||||
|
||||
public Double getDevPrice() { |
||||
return devPrice; |
||||
} |
||||
|
||||
public void setDevPrice(Double devPrice) { |
||||
this.devPrice = devPrice; |
||||
} |
||||
|
||||
public Double getLaborCost() { |
||||
return laborCost; |
||||
} |
||||
|
||||
public void setLaborCost(Double laborCost) { |
||||
this.laborCost = laborCost; |
||||
} |
||||
|
||||
public Integer getUseYears() { |
||||
return useYears; |
||||
} |
||||
|
||||
public void setUseYears(Integer useYears) { |
||||
this.useYears = useYears; |
||||
} |
||||
|
||||
public OriginalDevice getOriginalDevice() { |
||||
return originalDevice; |
||||
} |
||||
|
||||
public void setOriginalDevice(OriginalDevice originalDevice) { |
||||
this.originalDevice = originalDevice; |
||||
} |
||||
} |
@ -1,8 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
public class HeatingDevice { |
||||
|
||||
//id
|
||||
private String id; |
||||
//
|
||||
} |
@ -1,68 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class OriginalDevice { |
||||
|
||||
// 设备类型(1锅炉,2市政)
|
||||
private String deviceType; |
||||
// 设备数量(台)
|
||||
private Integer deviceNum; |
||||
// 功能(1供暖,2供冷,3热水)
|
||||
private Integer deviceFun; |
||||
// 设备能源类型(1煤,2油,3气,4汽)
|
||||
private String deviceEnergyType; |
||||
// 上年运行费用(万元)
|
||||
private Double lastYearFee; |
||||
// 原设备的人工费用(万元)
|
||||
private Double oldDaborCost; |
||||
|
||||
|
||||
|
||||
public String getDeviceType() { |
||||
return deviceType; |
||||
} |
||||
|
||||
public void setDeviceType(String deviceType) { |
||||
this.deviceType = deviceType; |
||||
} |
||||
|
||||
public Integer getDeviceNum() { |
||||
return deviceNum; |
||||
} |
||||
|
||||
public void setDeviceNum(Integer deviceNum) { |
||||
this.deviceNum = deviceNum; |
||||
} |
||||
|
||||
public Integer getDeviceFun() { |
||||
return deviceFun; |
||||
} |
||||
|
||||
public void setDeviceFun(Integer deviceFun) { |
||||
this.deviceFun = deviceFun; |
||||
} |
||||
|
||||
public String getDeviceEnergyType() { |
||||
return deviceEnergyType; |
||||
} |
||||
|
||||
public void setDeviceEnergyType(String deviceEnergyType) { |
||||
this.deviceEnergyType = deviceEnergyType; |
||||
} |
||||
|
||||
public Double getLastYearFee() { |
||||
return lastYearFee; |
||||
} |
||||
|
||||
public void setLastYearFee(Double lastYearFee) { |
||||
this.lastYearFee = lastYearFee; |
||||
} |
||||
|
||||
public Double getOldDaborCost() { |
||||
return oldDaborCost; |
||||
} |
||||
|
||||
public void setOldDaborCost(Double oldDaborCost) { |
||||
this.oldDaborCost = oldDaborCost; |
||||
} |
||||
} |
@ -1,38 +0,0 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<parent> |
||||
<artifactId>dntd-model-tools</artifactId> |
||||
<groupId>com.dky</groupId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</parent> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
|
||||
<artifactId>dntd-model-madekiln</artifactId> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>8</maven.compiler.source> |
||||
<maven.compiler.target>8</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
<dependencies> |
||||
<dependency> |
||||
<groupId>cn.hutool</groupId> |
||||
<artifactId>hutool-all</artifactId> |
||||
<version>5.4.5</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.dky</groupId> |
||||
<artifactId>dntd-modelI</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency> |
||||
<dependency> |
||||
<groupId>com.dky</groupId> |
||||
<artifactId>dntd-common</artifactId> |
||||
<version>1.0-SNAPSHOT</version> |
||||
</dependency> |
||||
</dependencies> |
||||
|
||||
</project> |
@ -1,92 +0,0 @@ |
||||
package com.dky.calculate; |
||||
|
||||
|
||||
public class Overall { |
||||
|
||||
/** |
||||
* 初次投资费用(万元) |
||||
* @param yearOut 预计年产量 |
||||
* @param madeHours 单台电设备制造一批产品的周期小时 |
||||
* @param proOut 单台电设备制造一批产品的产量 |
||||
* @param runHours 单台设备年运行时间 |
||||
* @param devicePrice 单台电设备价格 |
||||
* @return |
||||
*/ |
||||
public Double investment(Double yearOut, |
||||
Integer madeHours, |
||||
Integer proOut, |
||||
Integer runHours, |
||||
Double devicePrice){ |
||||
double d1 = yearOut * madeHours; |
||||
double d2 = proOut * runHours; |
||||
int remainder = (int)(d1/d2) + (d1%d2==0?0:1); |
||||
return remainder * devicePrice; |
||||
} |
||||
|
||||
/** |
||||
* 年运行费用(万元) |
||||
* @param deviceNum 电设备设备台数 |
||||
* @param devicePower 单台电设备的功率 |
||||
* @param days 电设备年运行时间 |
||||
* @param laborCost 电替代设备人工费用成本 |
||||
* @return |
||||
*/ |
||||
public Double getRunCost(Integer deviceNum, |
||||
Double devicePower, |
||||
Integer days, |
||||
Double laborCost){ |
||||
return deviceNum * devicePower * days * 0.5 + laborCost; |
||||
} |
||||
|
||||
/** |
||||
* 年总费用(万元) |
||||
* @param deviceNum 电设备设备台数 |
||||
* @param devicePrice 单台电设备价格 |
||||
* @param useYears 使用年限 |
||||
* @param devicePower 单台电设备的功率 |
||||
* @param days 电设备年运行时间(天) |
||||
* @param laborCost 电替代设备人工费用成本 |
||||
* @return |
||||
*/ |
||||
public Double getYearCost(Integer deviceNum, |
||||
Double devicePrice, |
||||
Integer useYears, |
||||
Double devicePower, |
||||
Integer days, |
||||
Double laborCost){ |
||||
double run = deviceNum * devicePower * days * 0.5 + laborCost; |
||||
return ((deviceNum * devicePrice) / useYears) + run; |
||||
} |
||||
|
||||
/** |
||||
* 年减碳 |
||||
* @param lastYearFee 上年运行费用(万元) |
||||
* @param oldDaborCost 原设备的人工费用(万元) |
||||
* @param deviceNum 电锅炉设备台数 |
||||
* @param devicePower 单台电锅炉的功率 |
||||
* @param days 年采暖(供冷)时间(天) |
||||
* @return |
||||
*/ |
||||
public Double calculateAnnualCarbonReduction(Double lastYearFee, |
||||
Double oldDaborCost, |
||||
Integer deviceNum, |
||||
Double devicePower, |
||||
Integer days){ |
||||
double d1 = (((lastYearFee - oldDaborCost) / 0.9) * 0.7143); |
||||
double d2 = deviceNum * devicePower * days ; |
||||
return (d1 - (d2 * 0.1229)) * 1.9003; |
||||
} |
||||
|
||||
/** |
||||
* 替代电量(千瓦时) |
||||
* @param deviceNum 电锅炉设备台数 |
||||
* @param devicePower 单台电锅炉的功率 |
||||
* @param days 年采暖(供冷)时间(天) |
||||
* @return |
||||
*/ |
||||
public Double getElectric(Integer deviceNum, |
||||
Double devicePower, |
||||
Integer days){ |
||||
return deviceNum * devicePower * days ; |
||||
} |
||||
} |
@ -1,116 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class MadeKiln { |
||||
|
||||
// 电替代设备的功率
|
||||
private Double devicePower; |
||||
// 单台电设备制造一批产品的周期(小时)
|
||||
private Integer madeHours; |
||||
// 单台电设备制造一批产品的产量
|
||||
private Integer proOut; |
||||
// 单台电设备价格
|
||||
private Double devPrice; |
||||
// 电替代设备人工费用
|
||||
private Double laborCost; |
||||
// 电设备年运行时间
|
||||
private Double runHours; |
||||
// 制造类型(1金属,2陶瓷,3其它)
|
||||
private Integer madeType; |
||||
// 预计年产量(吨)
|
||||
private Double yearOut; |
||||
// 工作容积(升)(合计)
|
||||
private Double volAge; |
||||
// 温度要求(摄氏度)
|
||||
private Double needTemp; |
||||
|
||||
private OriginalDevice originalDevice; |
||||
|
||||
public Double getDevicePower() { |
||||
return devicePower; |
||||
} |
||||
|
||||
public void setDevicePower(Double devicePower) { |
||||
this.devicePower = devicePower; |
||||
} |
||||
|
||||
public Integer getMadeHours() { |
||||
return madeHours; |
||||
} |
||||
|
||||
public void setMadeHours(Integer madeHours) { |
||||
this.madeHours = madeHours; |
||||
} |
||||
|
||||
public Integer getProOut() { |
||||
return proOut; |
||||
} |
||||
|
||||
public void setProOut(Integer proOut) { |
||||
this.proOut = proOut; |
||||
} |
||||
|
||||
public Double getDevPrice() { |
||||
return devPrice; |
||||
} |
||||
|
||||
public void setDevPrice(Double devPrice) { |
||||
this.devPrice = devPrice; |
||||
} |
||||
|
||||
public Double getLaborCost() { |
||||
return laborCost; |
||||
} |
||||
|
||||
public void setLaborCost(Double laborCost) { |
||||
this.laborCost = laborCost; |
||||
} |
||||
|
||||
public Double getRunHours() { |
||||
return runHours; |
||||
} |
||||
|
||||
public void setRunHours(Double runHours) { |
||||
this.runHours = runHours; |
||||
} |
||||
|
||||
public Integer getMadeType() { |
||||
return madeType; |
||||
} |
||||
|
||||
public void setMadeType(Integer madeType) { |
||||
this.madeType = madeType; |
||||
} |
||||
|
||||
public Double getYearOut() { |
||||
return yearOut; |
||||
} |
||||
|
||||
public void setYearOut(Double yearOut) { |
||||
this.yearOut = yearOut; |
||||
} |
||||
|
||||
public Double getVolAge() { |
||||
return volAge; |
||||
} |
||||
|
||||
public void setVolAge(Double volAge) { |
||||
this.volAge = volAge; |
||||
} |
||||
|
||||
public Double getNeedTemp() { |
||||
return needTemp; |
||||
} |
||||
|
||||
public void setNeedTemp(Double needTemp) { |
||||
this.needTemp = needTemp; |
||||
} |
||||
|
||||
public OriginalDevice getOriginalDevice() { |
||||
return originalDevice; |
||||
} |
||||
|
||||
public void setOriginalDevice(OriginalDevice originalDevice) { |
||||
this.originalDevice = originalDevice; |
||||
} |
||||
} |
@ -1,52 +0,0 @@ |
||||
package com.dky.entity; |
||||
|
||||
|
||||
public class OriginalDevice { |
||||
|
||||
private int equipmentType; // 设备类型(1锅炉,2窑炉,3灶台)
|
||||
private int quantity; // 台数(台)
|
||||
private int energyType; // 能源类型(1煤,2油,3气)
|
||||
private double previousYearOperatingCost; // 上年运行费用(万元)
|
||||
|
||||
private double oldLaborCost; // 原设备的人工费用
|
||||
|
||||
public double getOldLaborCost() { |
||||
return oldLaborCost; |
||||
} |
||||
|
||||
public void setOldLaborCost(double oldLaborCost) { |
||||
this.oldLaborCost = oldLaborCost; |
||||
} |
||||
|
||||
public int getEquipmentType() { |
||||
return equipmentType; |
||||
} |
||||
|
||||
public void setEquipmentType(int equipmentType) { |
||||
this.equipmentType = equipmentType; |
||||
} |
||||
|
||||
public int getQuantity() { |
||||
return quantity; |
||||
} |
||||
|
||||
public void setQuantity(int quantity) { |
||||
this.quantity = quantity; |
||||
} |
||||
|
||||
public int getEnergyType() { |
||||
return energyType; |
||||
} |
||||
|
||||
public void setEnergyType(int energyType) { |
||||
this.energyType = energyType; |
||||
} |
||||
|
||||
public double getPreviousYearOperatingCost() { |
||||
return previousYearOperatingCost; |
||||
} |
||||
|
||||
public void setPreviousYearOperatingCost(double previousYearOperatingCost) { |
||||
this.previousYearOperatingCost = previousYearOperatingCost; |
||||
} |
||||
} |
@ -1,7 +1,11 @@ |
||||
package com.dky.modelI; |
||||
|
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.utils.entity.SysDeviceHeatScene; |
||||
|
||||
import java.util.List; |
||||
|
||||
|
||||
public interface DntdModelI { |
||||
JSONObject createReport(JSONObject jsonObject); |
||||
JSONObject createReport(JSONObject jsonObject, List<SysDeviceHeatScene> alternateDeviceList); |
||||
} |
@ -1,63 +0,0 @@ |
||||
package com.dky; |
||||
|
||||
import cn.hutool.json.JSONArray; |
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.tool.ModelTool; |
||||
import com.dky.utils.entity.DevPrice; |
||||
import com.dky.utils.entity.DevSpec; |
||||
|
||||
public class Test { |
||||
public static void main(String[] args) { |
||||
JSONObject list = new JSONObject(); |
||||
JSONArray devSpecList = new JSONArray(); |
||||
JSONArray devPriceList = new JSONArray(); |
||||
DevSpec specObj1 = new DevSpec(); |
||||
DevSpec specObj2 = new DevSpec(); |
||||
DevSpec specObj3 = new DevSpec(); |
||||
specObj1.setId(1L); |
||||
specObj1.setTechnologyType("直热式电锅炉"); |
||||
specObj1.setHeatingArea(1.5); |
||||
specObj2.setId(2L); |
||||
specObj2.setTechnologyType("直热式电锅炉"); |
||||
specObj2.setHeatingArea(2.5); |
||||
specObj3.setId(3L); |
||||
specObj3.setTechnologyType("直热式电锅炉"); |
||||
specObj3.setHeatingArea(3.0); |
||||
devSpecList.add(specObj1); |
||||
devSpecList.add(specObj2); |
||||
devSpecList.add(specObj3); |
||||
list.put("devSpecList",devSpecList); |
||||
DevPrice devPrice1 = new DevPrice(); |
||||
DevPrice devPrice2 = new DevPrice(); |
||||
DevPrice devPrice3 = new DevPrice(); |
||||
devPrice1.setId(1); |
||||
devPrice1.setDevType("直热式电锅炉"); |
||||
devPrice1.setDevPrice(0.05); |
||||
devPrice2.setId(2); |
||||
devPrice2.setDevType("直热式电锅炉"); |
||||
devPrice2.setDevPrice(0.06); |
||||
devPrice3.setId(3); |
||||
devPrice3.setDevType("直热式电锅炉"); |
||||
devPrice3.setDevPrice(0.07); |
||||
devPriceList.add(devPrice1); |
||||
devPriceList.add(devPrice2); |
||||
devPriceList.add(devPrice3); |
||||
list.put("devPriceList",devPriceList); |
||||
ModelTool modelTool = new ModelTool(list); |
||||
JSONObject param = new JSONObject(); |
||||
param.put("type", "0101"); |
||||
param.put("exportTemperature", 28); |
||||
param.put("hotMedium", "1"); |
||||
param.put("hotDevicePower", "20.26"); |
||||
param.put("yearEnergy", "20.26"); |
||||
param.put("electricityPrice", "20.26"); |
||||
param.put("originalDevice", new JSONObject() |
||||
.put("deviceType", "1") |
||||
.put("deviceNum", 2) |
||||
.put("deviceEnergyType", "1") |
||||
.put("lastYearFee", "76.25")); |
||||
String key = "GWnQ4RqqTc8n1Uj59xLoUq0YsJLmzgyVzBvI35uj+DaDjdU0HZoU2fCd33JFsVG+3tWpkuojap/b5eeutSp6d4x4juou3yhCF7yhLBqYs1tdr2DF5QqL8uTsLJuKf1Ys8iufExureFAQw+qjMN+W5UlKE5id39PDi2nsPJGUbwkrvkywf2wqaqwZy+i/QBOl"; |
||||
JSONObject jsonObject = ModelTool.exeModel2Report(param,key);//exeModel2Report
|
||||
System.out.println(jsonObject.toString()); |
||||
} |
||||
} |
@ -0,0 +1,199 @@ |
||||
package com.dky.generate; |
||||
|
||||
|
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.calculate.*; |
||||
import com.dky.modelI.DntdModelI; |
||||
import com.dky.utils.entity.SysDeviceHeatScene; |
||||
import com.dky.utils.result.MatchedDevice; |
||||
|
||||
import java.text.DecimalFormat; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
public class BuildHeatingScene implements DntdModelI { |
||||
|
||||
DecimalFormat decimalFormat = new DecimalFormat("#.00"); |
||||
|
||||
// 首先A=由运行/合同容量折合成kW(x0.9)x85%,
|
||||
static final Double COEFFICIENT_1 = 0.9; |
||||
static final Double COEFFICIENT_2 = 0.85; |
||||
|
||||
@Override |
||||
public JSONObject createReport(JSONObject jsonObject,List<SysDeviceHeatScene> alternateDeviceList) { |
||||
|
||||
JSONObject distInfo = new JSONObject(); |
||||
JSONObject buildInfo = new JSONObject(); |
||||
JSONObject originalDevInfo = new JSONObject(); |
||||
|
||||
try{ |
||||
distInfo = (JSONObject) jsonObject.get("distInfo"); |
||||
buildInfo = (JSONObject) jsonObject.get("buildInfo"); |
||||
originalDevInfo = (JSONObject) jsonObject.get("originalDevInfo"); |
||||
} catch (Exception e){ |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
// 运行容量
|
||||
Double runCapacity = Double.parseDouble(distInfo.get("runCapacity").toString()); |
||||
// 上年最大需量
|
||||
Double lastYearNeed = Double.parseDouble(distInfo.get("lastYearNeed").toString()); |
||||
// 建筑面积
|
||||
Double heatingArea = Double.parseDouble(buildInfo.get("heatingArea").toString()); |
||||
// 年采暖时间(天)
|
||||
Integer days = Integer.parseInt(buildInfo.get("days").toString()); |
||||
// 上年运行费用(万元)
|
||||
Double lastYearFee = Double.parseDouble(buildInfo.get("lastYearFee").toString()); |
||||
|
||||
/* |
||||
实际可承载容量A = 运行(或合同容量)x0.9[将运行容量或合同容量折算成容量]x85% |
||||
*/ |
||||
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2; |
||||
/* |
||||
替代前设备总功率C |
||||
*/ |
||||
Double C = 0.0; |
||||
if (originalDevInfo != null) { |
||||
// 若存在原设备信息,则获取原设备中设备总功率,累加得出C
|
||||
} else { |
||||
// C=建筑面积(万平方米)x770
|
||||
C = (heatingArea / 10000) * 770; |
||||
} |
||||
|
||||
/* |
||||
根据建筑面积计算出不同技术类型下所需要不同功率设备数据 |
||||
*/ |
||||
List<List<MatchedDevice>> matchedDeviceGroupList = Scheme.calScheme(heatingArea, alternateDeviceList); |
||||
|
||||
/* |
||||
替代后设备总功率C1 |
||||
*/ |
||||
double C1 = 0.0; |
||||
if (originalDevInfo != null){ |
||||
//若存在原设备信息,则根据建筑面积计算每个技术类型下需要的不同功率的设备的数量,然后将不同功率及对应的数量进行计算得出总功率C1
|
||||
C1 = CalC.getC1(matchedDeviceGroupList); |
||||
} else { |
||||
C1 = C/2.5; |
||||
} |
||||
|
||||
/* |
||||
改造前最大需量D |
||||
*/ |
||||
double D = lastYearNeed + C; |
||||
|
||||
/* |
||||
改造后最大需量D1 |
||||
*/ |
||||
double D1 = lastYearNeed + C1; |
||||
|
||||
/* |
||||
判断计算占比,默认效率0.8,成本0.2 |
||||
*/ |
||||
double costRatio = 0.2; |
||||
double effRatio = 0.8; |
||||
try{ |
||||
double costRatio1 = Double.parseDouble(jsonObject.get("costRatio").toString()); |
||||
double effRatio1 = Double.parseDouble(jsonObject.get("effRatio").toString()); |
||||
if(costRatio1 < 1 && costRatio1 + costRatio1 == 1){ |
||||
costRatio = costRatio1; |
||||
effRatio = effRatio1; |
||||
} |
||||
}catch (Exception e){ |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
List<MatchedDevice> matchedDeviceList ; |
||||
Map<String, SchemeRatingRes> listMap ; |
||||
/* |
||||
根据具体容量与需量判断可使用的技术并计算评分 |
||||
*/ |
||||
//计算不同细类下成本最小值与效率最大值
|
||||
Map<String, Double> maxEffMap = SchemeRating.getMaxEfficiencyGroupByDevSubType(alternateDeviceList); |
||||
Map<String, Double> minPrice = SchemeRating.getMinPriceGroupByDevSubType(matchedDeviceGroupList); |
||||
String remark = ""; |
||||
if (D1 < A && A < D) { |
||||
// 判断只能用热泵
|
||||
List<List<MatchedDevice>> heatPumpDevList = new ArrayList<>(); |
||||
matchedDeviceGroupList.forEach((matchedDevices -> { |
||||
MatchedDevice matchedDevice = matchedDevices.get(0); |
||||
if (!"供冷/暖电锅炉".equals(matchedDevice.getDeviceHeatScene().getDevSubType())){ |
||||
heatPumpDevList.add(matchedDevices); |
||||
} |
||||
})); |
||||
|
||||
listMap = SchemeRating.getOptimalList(heatPumpDevList,costRatio,effRatio,maxEffMap,minPrice); |
||||
matchedDeviceList = SchemeRating.getOptimalScheme(listMap); |
||||
} else { |
||||
// 同时考虑热泵和电锅炉
|
||||
if ( A < D1){ |
||||
remark = "本方案存在扩容投资需求,扩容投资不计入初次投资费用"; |
||||
} |
||||
listMap = SchemeRating.getOptimalList(matchedDeviceGroupList,costRatio,effRatio,maxEffMap,minPrice); |
||||
matchedDeviceList = SchemeRating.getOptimalScheme(listMap); |
||||
} |
||||
|
||||
List<Map<String, Object>> maps = new ArrayList<>(); |
||||
listMap.forEach((k,v)->{ |
||||
Map<String, Object> map = new HashMap<>(); |
||||
map.put("rating", decimalFormat.format(v.getSchemeRating())); |
||||
map.put("plan", v.getList()); |
||||
map.put("planName", v.getPlanName()); |
||||
maps.add(map); |
||||
}); |
||||
|
||||
|
||||
/* |
||||
封装返回 |
||||
*/ |
||||
JSONObject returnJsonObject = new JSONObject(); |
||||
Double startCost = 0.0; |
||||
Double runCost = 0.0; |
||||
Double allCost = 0.0; |
||||
Double calculateAnnualCarbon = 0.0; |
||||
Double electric = 0.0; |
||||
List<HashMap<String,Object>> deviceList = new ArrayList<>(); |
||||
for (MatchedDevice matchedDevice : matchedDeviceList){ |
||||
HashMap<String, Object> map = new HashMap<>(); |
||||
map.put("devSubType",matchedDevice.getDeviceHeatScene().getDevSubType()); |
||||
map.put("devTechType",matchedDevice.getDeviceHeatScene().getDevTechType()); |
||||
map.put("devCount",matchedDevice.getCount()); |
||||
map.put("devPrice",matchedDevice.getDeviceHeatScene().getDevPrice()); |
||||
deviceList.add(map); |
||||
startCost = startCost + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getDevPrice()); |
||||
runCost = runCost + (BuildHeatingModel.getRunCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost())); |
||||
allCost = allCost + (BuildHeatingModel.getYearCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife(), matchedDevice.getDeviceHeatScene().getDevPower(), days, matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost())); |
||||
electric = electric + (BuildHeatingModel.getElectric(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days)); |
||||
calculateAnnualCarbon = calculateAnnualCarbon + (BuildHeatingModel.calculateAnnualCarbonReduction(lastYearFee, matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getLaborCost(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPower(), days)); |
||||
|
||||
} |
||||
//初次投资费用
|
||||
returnJsonObject.set("startCost", decimalFormat.format(startCost)); |
||||
// 设备总价
|
||||
returnJsonObject.set("devCost", decimalFormat.format(startCost)); |
||||
//年运行费用
|
||||
returnJsonObject.set("yearRunCost", decimalFormat.format(runCost)); |
||||
//年总费用
|
||||
returnJsonObject.set("yearCost", decimalFormat.format(allCost)); |
||||
//年减碳量
|
||||
returnJsonObject.set("calculate", decimalFormat.format(calculateAnnualCarbon/1000)); |
||||
//替代电量
|
||||
returnJsonObject.set("electric", decimalFormat.format(electric)); |
||||
//备注
|
||||
returnJsonObject.set("remark",remark); |
||||
//封装需配置设备情况
|
||||
returnJsonObject.set("deviceList",deviceList); |
||||
|
||||
//封装方案优势
|
||||
returnJsonObject.set("safety", BuildHeatingAdvantage.safety()); |
||||
returnJsonObject.set("economy", BuildHeatingAdvantage.economy(startCost, allCost, runCost, lastYearFee)); |
||||
returnJsonObject.set("intelligence", BuildHeatingAdvantage.intelligence()); |
||||
returnJsonObject.set("environment", BuildHeatingAdvantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon)))); |
||||
|
||||
//封装方案评分
|
||||
returnJsonObject.set("matchedDeviceList", maps); |
||||
|
||||
return returnJsonObject; |
||||
} |
||||
} |
@ -1,41 +0,0 @@ |
||||
package com.dky.generate; |
||||
|
||||
|
||||
import cn.hutool.json.JSONObject; |
||||
import com.dky.calculate.OverCollHeatAll; |
||||
import com.dky.entity.Construction; |
||||
import com.dky.entity.CoolHeat; |
||||
import com.dky.modelI.DntdModelI; |
||||
import com.dky.utils.entity.SysCustomerReceiptPower; |
||||
|
||||
public class BuildHeatingSence implements DntdModelI { |
||||
|
||||
@Override |
||||
public JSONObject createReport(JSONObject jsonObject) { |
||||
|
||||
//1.运行容量/合同容量折合成kW(x0.9)x85%
|
||||
Double A = 0.0; |
||||
JSONObject jsonObject1 = (JSONObject) jsonObject.get("receiptPower"); |
||||
SysCustomerReceiptPower receiptPower = jsonObject1.toBean(SysCustomerReceiptPower.class); |
||||
if (receiptPower.getContractCapacity()!=null){ |
||||
A = receiptPower.getContractCapacity()*0.9*0.85; |
||||
}else if (receiptPower.getRunCapacity()!=null){ |
||||
A = receiptPower.getRunCapacity()*0.9*0.85; |
||||
}else { |
||||
System.out.println("未获取到合同容量或运行容量"); |
||||
} |
||||
//2.冗余容量B=A-上年最大需量
|
||||
Double B = A-receiptPower.getLastYearNeed(); |
||||
//3.投入供热设备总功率C
|
||||
|
||||
JSONObject jsonReport = new JSONObject(); |
||||
CoolHeat coolHeat = jsonObject.toBean(CoolHeat.class); |
||||
Construction construction = jsonObject.toBean(Construction.class); |
||||
OverCollHeatAll overCollHeatAll = new OverCollHeatAll(); |
||||
overCollHeatAll.investment(construction.getFloor(), coolHeat.getHeatArea(), coolHeat.getDevPrice()); |
||||
// overCollHeatAll.getRunCost(coolHeat.getOriginalDevice().getQuantity(), coolHeat.getNeedPower(), coolHeat.g)
|
||||
|
||||
return null; |
||||
} |
||||
|
||||
} |
@ -1,2 +1,2 @@ |
||||
0101=generate.HeatBoilerSence |
||||
0102=generate.CoolHeatSence |
||||
0101=generate.BuildHeatingScene |
||||
0102=generate.HeatBoilerSence |
@ -1 +1 @@ |
||||
0101=generate.HeatBoilerSence |
||||
|
||||
|
Loading…
Reference in new issue