You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
6.3 KiB
131 lines
6.3 KiB
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;
|
|
}
|
|
|
|
|
|
}
|
|
|