|
|
|
package com.dky.test;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @Author:戴仕崑
|
|
|
|
* @Project:dntd-model-tools
|
|
|
|
* @Filename:Test
|
|
|
|
* @Slogan 致敬大师,致敬未来的你
|
|
|
|
* @Date:2024/3/7 16:14
|
|
|
|
* @Version 1.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
import com.dky.calculate.HeatBoilerScheme;
|
|
|
|
import com.dky.calculate.Scheme;
|
|
|
|
import com.dky.calculate.SchemeRating;
|
|
|
|
import com.dky.tool.ModelTool;
|
|
|
|
import com.dky.utils.entity.SysDeviceHeatScene;
|
|
|
|
import com.dky.utils.result.MatchedDevice;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class TestMain {
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
JSONObject param = new JSONObject();
|
|
|
|
param.put("type", "0102");
|
|
|
|
param.put("costRatio", 0.2);
|
|
|
|
param.put("effRatio", 0.8);
|
|
|
|
param.put("distInfo", new JSONObject()
|
|
|
|
.put("runCapacity", 2400.0)
|
|
|
|
.put("lastYearNeed", 1600.0));
|
|
|
|
param.put("heatUseNeedInfo", new JSONObject()
|
|
|
|
.put("heatingNeedPower", 33)
|
|
|
|
.put("thermometerValueOut", 112.45));
|
|
|
|
param.put("originalDevInfo", new JSONObject()
|
|
|
|
.put("previousYearEnergyUsage", 24090000)
|
|
|
|
.put("lastYearFee", 3000000));
|
|
|
|
String key = "GWnQ4RqqTc8n1Uj59xLoUtv975fmQsRWuvsk1zRmQu9TwIvlc6FTekndKMh+vMuRbI2bxdmuIxyZndYcg9u5xVa+HaiBZRP8OZFYIAo+66vDVlkBf47Nh2srjFyIXlLH";
|
|
|
|
|
|
|
|
// 构建JSONObject对象
|
|
|
|
JSONObject list = new JSONObject();
|
|
|
|
// 将设备列表放入JSONObject对象当中并且键为“devSpecList”(键名必须为“devSpecList”)
|
|
|
|
list.put("devSpecList", createDevList());
|
|
|
|
// 将这个JSONObject对象list作为入参调用ModelTool的create方法实现产品库初始化。
|
|
|
|
ModelTool modelTool = ModelTool.create(list);
|
|
|
|
// 调用ModelTool的唯一入口函数exeModel2Report,将场景参数param和密钥key作为入参传进去,得到输出结果电能替代报告。
|
|
|
|
System.out.println(modelTool.exeModel2Report(param, key));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static List<SysDeviceHeatScene>createDevList(){
|
|
|
|
List<SysDeviceHeatScene> deviceList = new ArrayList<>();
|
|
|
|
|
|
|
|
// 模拟从数据库中检索数据
|
|
|
|
Object[][] data =
|
|
|
|
{
|
|
|
|
{1, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 360.00, 80000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{2, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 720.00, 100000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{3, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电阻类)", 0.95, 1440.00, 160000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{4, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 360.00, 280000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{5, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 720.00, 460000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{6, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电极类)", 0.97, 1440.00, 900000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{7, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 360.00, 150000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{8, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 720.00, 180000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{9, "电锅炉", "工业供热电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 1440.00, 300000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{10, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 360.00, 360000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{11, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 720.00, 720000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{12, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 1440.00, 1440000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{13, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 360.00, 120000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{14, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 720.00, 160000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{15, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 1440.00, 280000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{16, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 360.00, 110000.00, 60000.00, 180000.00, 3000.00, 15, 4500, null},
|
|
|
|
{17, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 720.00, 150000.00, 60000.00, 180000.00, 6000.00, 15, 4500, null},
|
|
|
|
{18, "电锅炉", "工业供热电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 1440.00, 260000.00, 60000.00, 180000.00, 12000.00, 15, 4500, null},
|
|
|
|
{19, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 360.00, 80000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{20, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 720.00, 100000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{21, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电阻类)", 0.95, 1440.00, 160000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{22, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 360.00, 280000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{23, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 720.00, 460000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{24, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电极类)", 0.97, 1440.00, 900000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{25, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 360.00, 150000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{26, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 720.00, 180000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{27, "电锅炉", "供冷/暖电锅炉", "直热式电锅炉(电磁涡流类)", 0.98, 1440.00, 300000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{28, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 360.00, 360000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{29, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 720.00, 720000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{30, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(固体蓄热)", 0.95, 1440.00, 1440000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{31, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 360.00, 120000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{32, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 720.00, 160000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{33, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(相变蓄热)", 0.98, 1440.00, 280000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{34, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 360.00, 110000.00, 60000.00, 180000.00, 3000.00, 15, null, null},
|
|
|
|
{35, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 720.00, 150000.00, 60000.00, 180000.00, 6000.00, 15, null, null},
|
|
|
|
{36, "电锅炉", "供冷/暖电锅炉", "蓄热式电锅炉(水蓄)", 0.97, 1440.00, 260000.00, 60000.00, 180000.00, 12000.00, 15, null, null},
|
|
|
|
{37, "热泵", "供冷/暖", "水源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null},
|
|
|
|
{38, "热泵", "供冷/暖", "水源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null},
|
|
|
|
{39, "热泵", "供冷/暖", "水源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null},
|
|
|
|
{40, "热泵", "供冷/暖", "土壤源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null},
|
|
|
|
{41, "热泵", "供冷/暖", "土壤源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null},
|
|
|
|
{42, "热泵", "供冷/暖", "土壤源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null},
|
|
|
|
{43, "热泵", "供冷/暖", "空气源热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null},
|
|
|
|
{44, "热泵", "供冷/暖", "空气源热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null},
|
|
|
|
{45, "热泵", "供冷/暖", "空气源热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null},
|
|
|
|
{46, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 25.00, 45000.00, 60000.00, 180000.00, 500.00, 15, null, null},
|
|
|
|
{47, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 45.00, 75000.00, 60000.00, 180000.00, 1000.00, 15, null, null},
|
|
|
|
{48, "热泵", "供冷/暖", "低品位余热源(如电厂低温循环水)热泵", 4.00, 90.00, 140000.00, 60000.00, 180000.00, 2000.00, 15, null, null},
|
|
|
|
{49, "热泵", "供冷/暖", "高温蒸汽热泵", 3.00, 45.00, 380000.00, 60000.00, 180000.00, 1000.00, 15, null, null},
|
|
|
|
{50, "热泵", "供冷/暖", "高温蒸汽热泵", 3.00, 120.00, 550000.00, 60000.00, 180000.00, 2000.00, 15, null, null},
|
|
|
|
};
|
|
|
|
|
|
|
|
// 创建对象并添加到列表
|
|
|
|
for (Object[] row : data) {
|
|
|
|
int id = (int) row[0];
|
|
|
|
String devType = (String) row[1];
|
|
|
|
String devSubType = (String) row[2];
|
|
|
|
String devTechType = (String) row[3];
|
|
|
|
double heatEfficiency = (double) row[4];
|
|
|
|
double devPower = (double) row[5];
|
|
|
|
double devPrice = (double) row[6];
|
|
|
|
double devSubstituteLaborCost = (double) row[7];
|
|
|
|
double laborCost = (double) row[8];
|
|
|
|
double devReferenceArea = (double) row[9];
|
|
|
|
int devServiceLife = (int) row[10];
|
|
|
|
|
|
|
|
SysDeviceHeatScene device = new SysDeviceHeatScene(
|
|
|
|
id, devType, devSubType, devTechType, heatEfficiency, devPower, devPrice,
|
|
|
|
devSubstituteLaborCost, laborCost, devReferenceArea, devServiceLife, 4500, null);
|
|
|
|
|
|
|
|
deviceList.add(device);
|
|
|
|
}
|
|
|
|
return deviceList;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|