parent
8c81724b9e
commit
d6f2b57e5a
@ -0,0 +1,33 @@ |
|||||||
|
package com.dky.utils.enums; |
||||||
|
|
||||||
|
|
||||||
|
public enum EnergyPriceType { |
||||||
|
|
||||||
|
Residential_Electric_Price(0.55, "居民电价"), |
||||||
|
Industry_Electric_Price(1.2, "工业电价"), |
||||||
|
COAL_PRICE_PER_KILOGRAM(0.9, "煤炭平均价格/千克"); |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 能源价格 |
||||||
|
*/ |
||||||
|
private final Double price; |
||||||
|
/** |
||||||
|
* 描述 |
||||||
|
*/ |
||||||
|
private final String desc; |
||||||
|
|
||||||
|
public Double getPrice() { |
||||||
|
return price; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDesc() { |
||||||
|
return desc; |
||||||
|
} |
||||||
|
|
||||||
|
EnergyPriceType(Double price, String desc) { |
||||||
|
this.price = price; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
<?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"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>com.dky</groupId> |
||||||
|
<artifactId>dntd-model-tools</artifactId> |
||||||
|
<version>1.1-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
|
||||||
|
<artifactId>dntd-model-kitchencooking</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
|
||||||
|
<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> |
@ -0,0 +1,70 @@ |
|||||||
|
package com.dky.calculate; |
||||||
|
|
||||||
|
|
||||||
|
import com.dky.utils.enums.EnergyPriceType; |
||||||
|
|
||||||
|
public class KitchenCookModel { |
||||||
|
|
||||||
|
private static final double ELECTIRC_PRICE_KILOWATT_HOUR = EnergyPriceType.Residential_Electric_Price.getPrice(); // 居民平均电价(0.55元/千瓦时)
|
||||||
|
private static final double COAL_PRICE_PER_KILOGRAM = 0.9; // 煤炭的平均价格,单位:元/千克
|
||||||
|
private static final double STANDARD_COAL_CONVERSION_FACTOR = 0.7143; // 千克标准煤/千克
|
||||||
|
private static final double CO2_CONVERSION_FACTOR = 1.9003; // 千克二氧化碳/千克
|
||||||
|
private static final double ELECTRICITY_SUBSTITUTION_CONVERSION_FACTOR = 0.1229; // 千克标准煤/千瓦时
|
||||||
|
|
||||||
|
/** |
||||||
|
* 计算电厨炊年耗电量 |
||||||
|
* @param powerPerUnit 设备功率 |
||||||
|
* @param numberOfUnits 设备台数 |
||||||
|
* @param annualOperatingHours 电设备年运行时间 |
||||||
|
* @return 单台电厨炊的功率<A> * 电厨炊设备台数 * 电设备年运行时间<B> |
||||||
|
*/ |
||||||
|
public static double calculateAnnualElectricityConsumption(double powerPerUnit, int numberOfUnits, int annualOperatingHours) { |
||||||
|
return powerPerUnit * numberOfUnits * annualOperatingHours; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算年运行费用 |
||||||
|
* @param powerPerUnit 设备功率 |
||||||
|
* @param numberOfUnits 设备台数 |
||||||
|
* @param annualOperatingHours 电设备年运行时间 |
||||||
|
* @param laborCostForReplacement 电替代设备人工费用成本 |
||||||
|
* @return 电厨炊年耗电量 *平均电价(0.55元/千瓦时) + 电替代设备人工费用成本<A> |
||||||
|
*/ |
||||||
|
public static double calculateAnnualOperatingCost(double powerPerUnit, int numberOfUnits, int annualOperatingHours, double laborCostForReplacement) { |
||||||
|
return calculateAnnualElectricityConsumption(powerPerUnit, numberOfUnits, annualOperatingHours) * ELECTIRC_PRICE_KILOWATT_HOUR + laborCostForReplacement; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算总年费用 |
||||||
|
* @param numberOfUnits 电厨炊设备台数 |
||||||
|
* @param pricePerUnit 单台电设备价格 |
||||||
|
* @param usefulLifeYears 电厨炊的使用年限 |
||||||
|
* @param powerPerUnit 设备功率 |
||||||
|
* @param annualOperatingHours 电设备年运行时间 |
||||||
|
* @param laborCostForReplacement 电替代设备人工费用成本 |
||||||
|
* @return (电厨炊设备台数 *单台电设备价格<A>)/电厨炊的使用年限<A> + 年运行费用 |
||||||
|
*/ |
||||||
|
public static double calculateTotalAnnualCost(int numberOfUnits, double pricePerUnit, int usefulLifeYears, double powerPerUnit, int annualOperatingHours, double laborCostForReplacement) { |
||||||
|
double initialCost = numberOfUnits * pricePerUnit; |
||||||
|
double depreciationCost = initialCost / usefulLifeYears; |
||||||
|
return depreciationCost + calculateAnnualOperatingCost(powerPerUnit, numberOfUnits, annualOperatingHours, laborCostForReplacement); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算年减碳量 |
||||||
|
* @param lastYearFee 上年运行费用 |
||||||
|
* @param laborCostForOriginalDevice 原设备人工费用 |
||||||
|
* @param annualElectricityConsumption 电替代设备年耗电量 |
||||||
|
* @return 年减碳量=[(上年运行费用-原设备的人工费用)/煤炭平均价格(0.9元/千克)*0.7143千克标准煤/千克-电替代设备年耗电量*0.1229千克标准煤/千瓦时]*1.9003千克二氧化碳/千克 |
||||||
|
*/ |
||||||
|
public static double calculateAnnualCarbonReduction(double lastYearFee, double laborCostForOriginalDevice, double annualElectricityConsumption) { |
||||||
|
// (上年运行费用-原设备的人工费用)/煤炭平均价格(0.9元/千克)*0.7143千克标准煤/千克
|
||||||
|
double coalEquivalentFromPreviousYear = (lastYearFee - laborCostForOriginalDevice) / COAL_PRICE_PER_KILOGRAM * STANDARD_COAL_CONVERSION_FACTOR; |
||||||
|
// 电替代设备年耗电量 * 0.1229千克标准煤
|
||||||
|
double electricityEquivalent = annualElectricityConsumption * ELECTRICITY_SUBSTITUTION_CONVERSION_FACTOR; |
||||||
|
// (上年运行费用-原设备的人工费用)/煤炭平均价格(0.9元/千克)*0.7143千克标准煤/千克-电替代设备年耗电量*0.1229千克标准煤/千瓦时
|
||||||
|
double netReductionInCoalEquivalent = coalEquivalentFromPreviousYear - electricityEquivalent; |
||||||
|
return netReductionInCoalEquivalent * CO2_CONVERSION_FACTOR; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package com.dky.calculate; |
||||||
|
|
||||||
|
|
||||||
|
import com.dky.utils.entity.SysDeviceHeatScene; |
||||||
|
import com.dky.utils.result.MatchedDevice; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
public class KitchenCookScheme { |
||||||
|
|
||||||
|
public static List<MatchedDevice> getCookDevices(Integer peopleNum, List<SysDeviceHeatScene> sysDeviceHeatSceneList) { |
||||||
|
// 获取烹饪设备类型最少推荐使用人数
|
||||||
|
Integer cookDeviceType = getCookDeviceType(peopleNum, sysDeviceHeatSceneList); |
||||||
|
|
||||||
|
List<SysDeviceHeatScene> collect = sysDeviceHeatSceneList.stream().filter(SysDeviceHeatScene -> Objects.equals(SysDeviceHeatScene.getRecomMinPeopleNum(), cookDeviceType)).collect(Collectors.toList()); |
||||||
|
|
||||||
|
List<MatchedDevice> list = new ArrayList<>(); |
||||||
|
|
||||||
|
collect.forEach((device) ->{ |
||||||
|
list.add(new MatchedDevice(1, device)); |
||||||
|
}); |
||||||
|
|
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
public static Integer getCookDeviceType(Integer peopleNum, List<SysDeviceHeatScene> sysDeviceHeatSceneList) { |
||||||
|
ArrayList<SysDeviceHeatScene> collect = sysDeviceHeatSceneList.stream().collect( |
||||||
|
Collectors.collectingAndThen( |
||||||
|
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(SysDeviceHeatScene::getRecomMinPeopleNum))), |
||||||
|
ArrayList::new |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
IntSummaryStatistics intSummaryStatistics = collect.stream().mapToInt(SysDeviceHeatScene::getRecomMinPeopleNum).summaryStatistics(); |
||||||
|
|
||||||
|
for (SysDeviceHeatScene s : collect){ |
||||||
|
if (s.getRecomMinPeopleNum() >= intSummaryStatistics.getMax()){ |
||||||
|
return s.getRecomMinPeopleNum(); |
||||||
|
} else { |
||||||
|
boolean f1 = peopleNum >= s.getRecomMinPeopleNum(); |
||||||
|
boolean f2 = peopleNum <= s.getRecomMaxPeopleNum(); |
||||||
|
if (f1 && f2){ |
||||||
|
return s.getRecomMinPeopleNum(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return 1; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
<?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"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
<parent> |
||||||
|
<groupId>com.dky</groupId> |
||||||
|
<artifactId>dntd-model-tools</artifactId> |
||||||
|
<version>1.1-SNAPSHOT</version> |
||||||
|
</parent> |
||||||
|
|
||||||
|
<artifactId>dntd-model-materialkiln</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
|
||||||
|
<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> |
||||||
|
<scope>compile</scope> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
</project> |
@ -0,0 +1,126 @@ |
|||||||
|
package com.dky.calculate; |
||||||
|
|
||||||
|
|
||||||
|
import com.dky.utils.enums.EnergyPriceType; |
||||||
|
|
||||||
|
public class MaterialKilnModel { |
||||||
|
|
||||||
|
// 标准煤转换系数:千克标准煤/千克
|
||||||
|
private static final double coalConversionFactor = 0.7143; |
||||||
|
// 电能转换到标准煤的系数:千克标准煤/千瓦时
|
||||||
|
private static final double electricityConversionFactor = 0.1229; |
||||||
|
// 标准煤转换到二氧化碳的系数:千克二氧化碳/千克标准煤
|
||||||
|
private static final double carbonConversionFactor = 1.9003; |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算初次投资费用 |
||||||
|
* |
||||||
|
* @param productDensity 产品的密度 |
||||||
|
* @param furnaceWorkingVolume 电窑炉的工作容积 |
||||||
|
* @param expectedAnnualOutput 预计年产量 |
||||||
|
* @param batchProductionHours 单台电设备制造一批产品的周期小时 |
||||||
|
* @param equipmentAnnualHours 单台设备年运行时间 |
||||||
|
* @param singleEquipmentPrice 单台电设备价格 |
||||||
|
* @return 包含计算结果的对象 |
||||||
|
*/ |
||||||
|
public static Double calculateProduction( |
||||||
|
Double productDensity, |
||||||
|
Double furnaceWorkingVolume, |
||||||
|
Double expectedAnnualOutput, |
||||||
|
Double batchProductionHours, |
||||||
|
Double equipmentAnnualHours, |
||||||
|
Double singleEquipmentPrice |
||||||
|
) { |
||||||
|
// 单台电设备制造一批产品的产量 = 产品的密度*电窑炉的工作容积
|
||||||
|
double singleBatchProduction = productDensity * furnaceWorkingVolume; |
||||||
|
|
||||||
|
// 电替代设备台数 = (预计年产量*单台电设备制造一批产品的周期小时<A>)/(单台电设备制造一批产品的产量<A>*单台设备年运行时间<B>)
|
||||||
|
double equipmentCount = (expectedAnnualOutput * batchProductionHours) / |
||||||
|
(singleBatchProduction * equipmentAnnualHours); |
||||||
|
|
||||||
|
// 初次投资费用 = 电替代设备台数*单台电设备价格<A>
|
||||||
|
return equipmentCount * singleEquipmentPrice; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 计算年运行费用 |
||||||
|
* |
||||||
|
* @param devicePower 电替代设备功率 |
||||||
|
* @param deviceCount 电替代设备台数 |
||||||
|
* @param deviceSubstituteLaborCost 电替代设备人工费用 |
||||||
|
* @param deviceAnnualOperationTime 电替代设备年运行时间 |
||||||
|
* @return 年运行费用 |
||||||
|
*/ |
||||||
|
public static double calculateAnnualOperatingCost(Double devicePower, Integer deviceCount, Double deviceSubstituteLaborCost, Integer deviceAnnualOperationTime) { |
||||||
|
|
||||||
|
// 电替代设备年耗电量=单台电替代设备的功率<A>*电替代设备台数*电设备年运行时间<B>
|
||||||
|
double annualElectricityConsumption = devicePower * deviceCount * deviceAnnualOperationTime; |
||||||
|
// 年运行费用=电替代设备年耗电量*工业平均电价(1.2元/千瓦时) + 单台电替代设备人工费用成本<A> * 台数
|
||||||
|
return annualElectricityConsumption * EnergyPriceType.Industry_Electric_Price.getPrice() + deviceSubstituteLaborCost * deviceCount; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算年总费用 |
||||||
|
* |
||||||
|
* @param devicePower 电替代设备功率 |
||||||
|
* @param deviceCount 电替代设备台数 |
||||||
|
* @param deviceSubstituteLaborCost 电替代设备人工费用 |
||||||
|
* @param deviceAnnualOperationTime 电替代设备年运行时间 |
||||||
|
* @param devicePrice 设备价格 |
||||||
|
* @param deviceServiceLife 设备使用年限 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static double calculateAnnualTotalCost(Double devicePower, Integer deviceCount, Double deviceSubstituteLaborCost, Integer deviceAnnualOperationTime, Double devicePrice, Integer deviceServiceLife) { |
||||||
|
//(电替代设备台数*单台电设备价格<A>)/电替代设备的使用年限<A>
|
||||||
|
double v = ((devicePrice * deviceCount) / deviceServiceLife); |
||||||
|
// 年总费用 =(电替代设备台数*单台电设备价格<A>)/电替代设备的使用年限<A> + 年运行费用
|
||||||
|
return v + calculateAnnualOperatingCost(devicePower, deviceCount, deviceSubstituteLaborCost, deviceAnnualOperationTime); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算年减碳量。 |
||||||
|
* |
||||||
|
* @param previousYearOperatingCost 上年运行费用 |
||||||
|
* @param originalEquipmentLaborCost 原设备的人工费用 |
||||||
|
* @param electricitySubstitutionAnnualConsumption 电替代设备年耗电量 |
||||||
|
* @return 年减碳量 |
||||||
|
*/ |
||||||
|
public static double calculateAnnualCarbonReduction( |
||||||
|
Double previousYearOperatingCost, |
||||||
|
Double originalEquipmentLaborCost, |
||||||
|
Double electricitySubstitutionAnnualConsumption |
||||||
|
) { |
||||||
|
// 计算节约的煤炭量(转换为标准煤)=(上年运行费用-原设备的人工费用)/煤炭平均价格(0.9元/千克)*0.7143千克标准煤/千克
|
||||||
|
double savedCoalInStandardCoal = (previousYearOperatingCost - originalEquipmentLaborCost) / |
||||||
|
EnergyPriceType.COAL_PRICE_PER_KILOGRAM.getPrice() * coalConversionFactor; |
||||||
|
|
||||||
|
// 计算电替代设备消耗的电量转换为标准煤的量
|
||||||
|
double electricityInStandardCoal = electricitySubstitutionAnnualConsumption * electricityConversionFactor; |
||||||
|
|
||||||
|
// 计算总的节约的标准煤量
|
||||||
|
double totalSavedStandardCoal = savedCoalInStandardCoal - electricityInStandardCoal; |
||||||
|
|
||||||
|
// 计算年减碳量
|
||||||
|
return totalSavedStandardCoal * carbonConversionFactor; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 计算电替代设备年耗电量 |
||||||
|
* |
||||||
|
* @param devicePower 设备功率 |
||||||
|
* @param deviceCount 设备台数 |
||||||
|
* @param deviceAnnualOperationTime 单台电设备年运行时间 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static double calculateSubstituteElectricity(Double devicePower, Integer deviceCount, Integer deviceAnnualOperationTime) { |
||||||
|
// 电替代设备年耗电量 = 电替代设备的功率<A> * 电替代设备台数 * 电设备年运行时间<B>
|
||||||
|
return devicePower * deviceCount * deviceAnnualOperationTime; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.dky.calculate; |
||||||
|
|
||||||
|
|
||||||
|
import com.dky.utils.entity.SysDeviceHeatScene; |
||||||
|
import com.dky.utils.result.MatchedDevice; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class MaterialKilnScheme { |
||||||
|
|
||||||
|
|
||||||
|
public static List<MatchedDevice> calSchemeByTechType(Double workArea, List<SysDeviceHeatScene> sysDeviceHeatSceneList) { |
||||||
|
// 对技术类型下的设备list按照单台设备工作容积进行排序
|
||||||
|
sysDeviceHeatSceneList.sort((o1, o2) -> Double.compare(o2.getDevWorkArea(), o1.getDevWorkArea())); |
||||||
|
Double remainArea = workArea; |
||||||
|
// 遍历设备,根据工作容积进行匹配设备数量
|
||||||
|
List<MatchedDevice> matchedDeviceList = new ArrayList<>(); |
||||||
|
for (SysDeviceHeatScene deviceHeatScene : sysDeviceHeatSceneList) { |
||||||
|
double v = remainArea / deviceHeatScene.getDevWorkArea(); |
||||||
|
int count = (int) (v); |
||||||
|
if (v < 1) { |
||||||
|
count = count + 1; |
||||||
|
} |
||||||
|
remainArea = remainArea - count * deviceHeatScene.getDevWorkArea(); |
||||||
|
matchedDeviceList.add(new MatchedDevice(count, deviceHeatScene)); |
||||||
|
if (remainArea <= 0) { |
||||||
|
// 当总供暖面积已经满足需求时,跳出循环,不再选择其他设备
|
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
return matchedDeviceList; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,133 @@ |
|||||||
|
package com.dky.generate; |
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject; |
||||||
|
import com.dky.calculate.*; |
||||||
|
import com.dky.modelI.DntdModelI; |
||||||
|
import com.dky.utils.GetTargetDeviceList; |
||||||
|
import com.dky.utils.entity.SysDeviceHeatScene; |
||||||
|
import com.dky.utils.enums.DeviceSubType; |
||||||
|
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 KitchenCookScene 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> sceneList) { |
||||||
|
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.main(DeviceSubType.Kitchen_Cooking.getDesc(), sceneList); |
||||||
|
|
||||||
|
JSONObject distInfo = new JSONObject(); |
||||||
|
|
||||||
|
try{ |
||||||
|
distInfo = (JSONObject) jsonObject.get("distInfo"); |
||||||
|
} catch (Exception e){ |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
|
||||||
|
// 运行容量
|
||||||
|
Double runCapacity = Double.parseDouble(distInfo.get("runCapacity").toString()); |
||||||
|
// 上年最大需量
|
||||||
|
Double lastYearNeed = Double.parseDouble(distInfo.get("lastYearNeed").toString()); |
||||||
|
// 上年运行费用(万元)
|
||||||
|
Double lastYearFee = Double.parseDouble(jsonObject.get("lastYearFee").toString()); |
||||||
|
// 人数
|
||||||
|
Integer peopleNum = Integer.parseInt(jsonObject.get("peopleNum").toString()); |
||||||
|
|
||||||
|
/* |
||||||
|
实际可承载容量A = 运行(或合同容量)x0.9[将运行容量或合同容量折算成容量]x85% |
||||||
|
*/ |
||||||
|
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2; |
||||||
|
|
||||||
|
/* |
||||||
|
根据人数计算出不同技术类型下所需要不同功率设备数据 |
||||||
|
*/ |
||||||
|
List<MatchedDevice> cookDevices = KitchenCookScheme.getCookDevices(peopleNum, alternateDeviceList); |
||||||
|
/* |
||||||
|
替代后设备总功率C1 |
||||||
|
*/ |
||||||
|
double C1 = 0.0; |
||||||
|
|
||||||
|
for (MatchedDevice matchedDevice : cookDevices){ |
||||||
|
C1 = C1 + matchedDevice.getDeviceHeatScene().getDevPower() * matchedDevice.getCount(); |
||||||
|
} |
||||||
|
|
||||||
|
/* |
||||||
|
改造后最大需量D1 |
||||||
|
*/ |
||||||
|
double D1 = lastYearNeed + C1; |
||||||
|
|
||||||
|
String remark = ""; |
||||||
|
if ( A < D1){ |
||||||
|
remark = "本方案存在扩容投资需求,扩容投资不计入初次投资费用"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
封装返回 |
||||||
|
*/ |
||||||
|
JSONObject returnJsonObject = new JSONObject(); |
||||||
|
Double startCost = 0.0; |
||||||
|
Double runCost = 0.0; |
||||||
|
Double allCost = 0.0; |
||||||
|
Double calculateAnnualCarbon = 0.0; |
||||||
|
Double laborCost = 0.0; |
||||||
|
Double electric = 0.0; |
||||||
|
List<HashMap<String,Object>> deviceList = new ArrayList<>(); |
||||||
|
for (MatchedDevice matchedDevice : cookDevices){ |
||||||
|
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 + (KitchenCookModel.calculateAnnualOperatingCost(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost())); |
||||||
|
|
||||||
|
allCost = allCost + (KitchenCookModel.calculateTotalAnnualCost(matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife(), |
||||||
|
matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost())); |
||||||
|
|
||||||
|
electric = electric + (KitchenCookModel.calculateAnnualElectricityConsumption(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime())); |
||||||
|
|
||||||
|
laborCost = laborCost + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getLaborCost() / matchedDevice.getDeviceHeatScene().getDevServiceLife()); |
||||||
|
|
||||||
|
} |
||||||
|
//初次投资费用
|
||||||
|
returnJsonObject.set("startCost", decimalFormat.format(startCost)); |
||||||
|
// 设备总价
|
||||||
|
returnJsonObject.set("devCost", decimalFormat.format(startCost)); |
||||||
|
//年运行费用
|
||||||
|
returnJsonObject.set("yearRunCost", decimalFormat.format(runCost)); |
||||||
|
//年总费用
|
||||||
|
returnJsonObject.set("yearCost", decimalFormat.format(allCost)); |
||||||
|
//年减碳量
|
||||||
|
calculateAnnualCarbon = KitchenCookModel.calculateAnnualCarbonReduction(lastYearFee, laborCost, electric); |
||||||
|
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", Advantage.economy(startCost, runCost, lastYearFee)); |
||||||
|
returnJsonObject.set("intelligence", BuildHeatingAdvantage.intelligence()); |
||||||
|
returnJsonObject.set("environment", BuildHeatingAdvantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon/1000)))); |
||||||
|
|
||||||
|
return returnJsonObject; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,131 @@ |
|||||||
|
package com.dky.generate; |
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject; |
||||||
|
import com.dky.calculate.*; |
||||||
|
import com.dky.modelI.DntdModelI; |
||||||
|
import com.dky.utils.GetTargetDeviceList; |
||||||
|
import com.dky.utils.entity.SysDeviceHeatScene; |
||||||
|
import com.dky.utils.enums.DeviceSubType; |
||||||
|
import com.dky.utils.result.MatchedDevice; |
||||||
|
|
||||||
|
import java.text.DecimalFormat; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
public class MaterialKilnScene 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> list) { |
||||||
|
|
||||||
|
List<SysDeviceHeatScene> alternateDeviceList = GetTargetDeviceList.main(DeviceSubType.Material_Kiln.getDesc(), list); |
||||||
|
// System.out.println("工业锅炉供热: " + alternateDeviceList + "\n");
|
||||||
|
|
||||||
|
JSONObject distInfo = new JSONObject(); |
||||||
|
JSONObject heatUseNeedInfo = new JSONObject(); |
||||||
|
JSONObject originalDevInfo = new JSONObject(); |
||||||
|
|
||||||
|
try { |
||||||
|
distInfo = (JSONObject) jsonObject.get("distInfo"); |
||||||
|
heatUseNeedInfo = (JSONObject) jsonObject.get("heatUseNeedInfo"); |
||||||
|
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()); |
||||||
|
// 工作容积(单位: m³)【 1 立方米=1000 升 】
|
||||||
|
Double workArea = Double.parseDouble(heatUseNeedInfo.get("workArea").toString()) / 1000; |
||||||
|
// 预计年产量(吨)
|
||||||
|
Double yearOutPut = Double.parseDouble(heatUseNeedInfo.get("yearOutPut").toString()); |
||||||
|
// 上年运行费用(元)
|
||||||
|
Double lastYearFee = Double.parseDouble(originalDevInfo.get("lastYearFee").toString()); |
||||||
|
|
||||||
|
// 根据供热需量设备功率计算出不同技术类型下所需要不同功率设备数据
|
||||||
|
List<MatchedDevice> matchedDeviceGroupList = MaterialKilnScheme.calSchemeByTechType(workArea, alternateDeviceList); |
||||||
|
|
||||||
|
// 实际可承载容量A = 运行(或合同容量)x0.9 [将运行容量或合同容量折算成容量] x85%
|
||||||
|
double A = runCapacity * COEFFICIENT_1 * COEFFICIENT_2; |
||||||
|
// 根据供热需量设备功率计算每个技术类型下需要的不同功率的设备的数量,然后将不同功率及对应的数量进行计算得出总功率C1,取最大
|
||||||
|
Double C1 = CalC.getC1(Collections.singletonList(matchedDeviceGroupList)); |
||||||
|
|
||||||
|
// 改造后最大需量
|
||||||
|
double D1 = lastYearNeed + C1; |
||||||
|
|
||||||
|
String remark = ""; |
||||||
|
|
||||||
|
// 同时考虑热泵和电锅炉
|
||||||
|
if (A < D1) { |
||||||
|
remark = "本方案存在扩容投资需求,扩容投资不计入初次投资费用"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/* |
||||||
|
封装返回 |
||||||
|
*/ |
||||||
|
JSONObject returnJsonObject = new JSONObject(); |
||||||
|
Double startCost = 0.0; |
||||||
|
Double runCost = 0.0; |
||||||
|
Double allCost = 0.0; |
||||||
|
Double calculateAnnualCarbon = 0.0; |
||||||
|
Double laborFee1 = 0.0; |
||||||
|
Double electric = 0.0; |
||||||
|
List<HashMap<String, Object>> deviceList = new ArrayList<>(); |
||||||
|
for (MatchedDevice matchedDevice : matchedDeviceGroupList) { |
||||||
|
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 + (MaterialKilnModel.calculateAnnualOperatingCost(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime())); |
||||||
|
|
||||||
|
allCost = allCost + (MaterialKilnModel.calculateAnnualTotalCost(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevSubstituteLaborCost(), |
||||||
|
matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime(), matchedDevice.getDeviceHeatScene().getDevPrice(), matchedDevice.getDeviceHeatScene().getDevServiceLife())); |
||||||
|
|
||||||
|
electric = electric + (MaterialKilnModel.calculateSubstituteElectricity(matchedDevice.getDeviceHeatScene().getDevPower(), matchedDevice.getCount(), matchedDevice.getDeviceHeatScene().getDevAnnualOperationTime())); |
||||||
|
|
||||||
|
laborFee1 = laborFee1 + (matchedDevice.getCount() * matchedDevice.getDeviceHeatScene().getDevPrice() / matchedDevice.getDeviceHeatScene().getDevServiceLife()); |
||||||
|
|
||||||
|
} |
||||||
|
//初次投资费用
|
||||||
|
returnJsonObject.set("startCost", decimalFormat.format(startCost)); |
||||||
|
// 设备总价
|
||||||
|
returnJsonObject.set("devCost", decimalFormat.format(startCost)); |
||||||
|
//年运行费用
|
||||||
|
returnJsonObject.set("yearRunCost", decimalFormat.format(runCost)); |
||||||
|
//年总费用
|
||||||
|
returnJsonObject.set("yearCost", decimalFormat.format(allCost)); |
||||||
|
//年减碳量
|
||||||
|
calculateAnnualCarbon = MaterialKilnModel.calculateAnnualCarbonReduction(lastYearFee, laborFee1, electric); |
||||||
|
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", Advantage.economy(startCost, runCost, lastYearFee)); |
||||||
|
returnJsonObject.set("intelligence", BuildHeatingAdvantage.intelligence()); |
||||||
|
returnJsonObject.set("environment", BuildHeatingAdvantage.environment(Double.valueOf(decimalFormat.format(calculateAnnualCarbon / 1000)))); |
||||||
|
|
||||||
|
|
||||||
|
return returnJsonObject; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -1,2 +1,4 @@ |
|||||||
0101=generate.BuildHeatingScene |
0101=generate.BuildHeatingScene |
||||||
0102=generate.HeatBoilerScene |
0102=generate.HeatBoilerScene |
||||||
|
0103=generate.KitchenCookScene |
||||||
|
0104=generate.MaterialKilnScene |
Loading…
Reference in new issue