|
|
|
|
@ -62,6 +62,12 @@ public class GetOtherSysDataJob {
|
|
|
|
|
"PowerTotal" // 机房累计读数
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//TODO 冷源制冷量
|
|
|
|
|
private final String[] coolingSourceMeters = new String[]{ |
|
|
|
|
"ColdRealLoadKW", // 瞬时冷量
|
|
|
|
|
"ColdRealLoadTONTatol" // 累计冷量
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
//TODO 主机总电表
|
|
|
|
|
private final String[] powerMeters = new String[]{ |
|
|
|
|
"ChPower", // 主机实时功率
|
|
|
|
|
@ -141,7 +147,9 @@ public class GetOtherSysDataJob {
|
|
|
|
|
powerMeters[0].equals(param.getMtCode()) || powerMeters[1].equals(param.getMtCode()) || |
|
|
|
|
freezePumpMeters[0].equals(param.getMtCode()) || freezePumpMeters[1].equals(param.getMtCode()) || |
|
|
|
|
coolPumpMeters[0].equals(param.getMtCode()) || coolPumpMeters[1].equals(param.getMtCode()) || |
|
|
|
|
towerMeters[0].equals(param.getMtCode()) || towerMeters[1].equals(param.getMtCode())) { |
|
|
|
|
towerMeters[0].equals(param.getMtCode()) || towerMeters[1].equals(param.getMtCode()) || |
|
|
|
|
coolingSourceMeters[0].equals(param.getMtCode()) || coolingSourceMeters[1].equals(param.getMtCode()) |
|
|
|
|
) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -243,6 +251,7 @@ public class GetOtherSysDataJob {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 计算并添加汇总数据到cumulativeDatas |
|
|
|
|
* |
|
|
|
|
* @param cumulativeDatas 累计读数数据列表 |
|
|
|
|
* @param mtCodeToOtherNameMap mtCode到otherName的映射关系 |
|
|
|
|
*/ |
|
|
|
|
@ -259,23 +268,37 @@ public class GetOtherSysDataJob {
|
|
|
|
|
CHWP_POWER("冷冻泵", "瞬时功率", "PriChWPPower", "冷冻泵总瞬时功率"), |
|
|
|
|
CWP_POWER("冷却泵", "瞬时功率", "CWPPower", "冷却泵总瞬时功率"), |
|
|
|
|
CT_POWER("冷却塔", "瞬时功率", "CTPower", "冷却塔总瞬时功率"), |
|
|
|
|
|
|
|
|
|
// 冷源瞬时冷量(特殊计算:SystemRealLoadTON - HPSystemRealLoadTON)
|
|
|
|
|
CH_COLD_INSTANT("冷源", "瞬时冷量", "ColdRealLoadKW", "冷源总冷量计瞬时冷量", true), |
|
|
|
|
ALL_COLD_INSTANT("冷源", "累计冷量", "ColdRealLoadTONTatol", "冷源总冷量计读数TON", true), |
|
|
|
|
|
|
|
|
|
ALL_POWER(null, "瞬时功率", "Power", "机房总瞬时功率"); |
|
|
|
|
|
|
|
|
|
private final String deviceKeyword; |
|
|
|
|
private final String dataKeyword; |
|
|
|
|
private final String mtCode; |
|
|
|
|
private final String description; |
|
|
|
|
private final boolean isColdCalculation; // 标记是否为冷量计算(需要用减法)
|
|
|
|
|
|
|
|
|
|
SummaryType(String deviceKeyword, String dataKeyword, String mtCode, String description) { |
|
|
|
|
this(deviceKeyword, dataKeyword, mtCode, description, false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SummaryType(String deviceKeyword, String dataKeyword, String mtCode, String description, boolean isColdCalculation) { |
|
|
|
|
this.deviceKeyword = deviceKeyword; |
|
|
|
|
this.dataKeyword = dataKeyword; |
|
|
|
|
this.mtCode = mtCode; |
|
|
|
|
this.description = description; |
|
|
|
|
this.isColdCalculation = isColdCalculation; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 一次性遍历cumulativeDatas,分类累加各类型数据
|
|
|
|
|
Map<SummaryType, BigDecimal> summaryMap = new HashMap<>(); |
|
|
|
|
// 缓存原始数据,用于冷量差值计算(按tag缓存)
|
|
|
|
|
Map<String, BigDecimal> dataByTag = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
// 初始化所有汇总类型
|
|
|
|
|
for (SummaryType type : SummaryType.values()) { |
|
|
|
|
summaryMap.put(type, BigDecimal.ZERO); |
|
|
|
|
@ -288,16 +311,85 @@ public class GetOtherSysDataJob {
|
|
|
|
|
String tag = data.getTag(); |
|
|
|
|
BigDecimal value = new BigDecimal(data.getValue().toString()); |
|
|
|
|
|
|
|
|
|
// 缓存所有数据,用于冷量计算
|
|
|
|
|
dataByTag.put(tag, value); |
|
|
|
|
|
|
|
|
|
// 遍历所有汇总类型进行匹配
|
|
|
|
|
for (SummaryType type : SummaryType.values()) { |
|
|
|
|
boolean matchesDataKeyword = tag.contains(type.dataKeyword); |
|
|
|
|
boolean matchesDeviceKeyword = type.deviceKeyword == null || tag.contains(type.deviceKeyword); |
|
|
|
|
|
|
|
|
|
if (matchesDataKeyword && matchesDeviceKeyword) { |
|
|
|
|
// 冷量计算类型不进行累加,使用差值计算
|
|
|
|
|
if (!type.isColdCalculation) { |
|
|
|
|
summaryMap.merge(type, value, BigDecimal::add); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 对冷量计算类型执行差值计算
|
|
|
|
|
try { |
|
|
|
|
// 从缓存中查找冷量相关数据
|
|
|
|
|
BigDecimal hpSystemRealLoadTONTatol = null; // 热泵累计冷量
|
|
|
|
|
BigDecimal hpSystemRealLoadTON = null; // 热泵瞬时冷量
|
|
|
|
|
BigDecimal systemRealLoadTON = null; // 系统瞬时冷量
|
|
|
|
|
BigDecimal systemRealLoadTONTatol = null; // 系统累计冷量
|
|
|
|
|
|
|
|
|
|
// 查找 hpSystemRealLoadTONTatol
|
|
|
|
|
for (Map.Entry<String, BigDecimal> entry : dataByTag.entrySet()) { |
|
|
|
|
if (entry.getKey().contains("HPSystemRealLoadTONTatol")) { |
|
|
|
|
hpSystemRealLoadTONTatol = entry.getValue(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查找 HPSystemRealLoadTON
|
|
|
|
|
for (Map.Entry<String, BigDecimal> entry : dataByTag.entrySet()) { |
|
|
|
|
if (entry.getKey().contains("HPSystemRealLoadTON")) { |
|
|
|
|
hpSystemRealLoadTON = entry.getValue(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查找 systemRealLoadTON
|
|
|
|
|
for (Map.Entry<String, BigDecimal> entry : dataByTag.entrySet()) { |
|
|
|
|
if (entry.getKey().contains("SystemRealLoadTON")) { |
|
|
|
|
systemRealLoadTON = entry.getValue(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查找 SystemRealLoadTONTatol
|
|
|
|
|
for (Map.Entry<String, BigDecimal> entry : dataByTag.entrySet()) { |
|
|
|
|
if (entry.getKey().contains("SystemRealLoadTONTatol")) { |
|
|
|
|
systemRealLoadTONTatol = entry.getValue(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 计算瞬时冷量:systemRealLoadTON - HPSystemRealLoadTON
|
|
|
|
|
if (systemRealLoadTON != null && hpSystemRealLoadTON != null) { |
|
|
|
|
BigDecimal coldRealLoadKW = systemRealLoadTON.subtract(hpSystemRealLoadTON); |
|
|
|
|
summaryMap.put(SummaryType.CH_COLD_INSTANT, coldRealLoadKW); |
|
|
|
|
log.info("计算瞬时冷量: {} - {} = {}", systemRealLoadTON, hpSystemRealLoadTON, coldRealLoadKW); |
|
|
|
|
} else { |
|
|
|
|
log.warn("瞬时冷量计算缺少必要数据,SystemRealLoadTON: {}, HPSystemRealLoadTON: {}", |
|
|
|
|
systemRealLoadTON, hpSystemRealLoadTON); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 计算累计冷量:SystemRealLoadTONTatol - HPSystemRealLoadTONTatol
|
|
|
|
|
if (systemRealLoadTONTatol != null && hpSystemRealLoadTONTatol != null) { |
|
|
|
|
BigDecimal coldRealLoadTONTatol = systemRealLoadTONTatol.subtract(hpSystemRealLoadTONTatol); |
|
|
|
|
summaryMap.put(SummaryType.ALL_COLD_INSTANT, coldRealLoadTONTatol); |
|
|
|
|
log.info("计算累计冷量: {} - {} = {}", systemRealLoadTONTatol, hpSystemRealLoadTONTatol, coldRealLoadTONTatol); |
|
|
|
|
} else { |
|
|
|
|
log.warn("累计冷量计算缺少必要数据,SystemRealLoadTONTatol: {}, HPSystemRealLoadTONTatol: {}", |
|
|
|
|
systemRealLoadTONTatol, hpSystemRealLoadTONTatol); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("计算冷量差值异常", e); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 创建并添加汇总数据点
|
|
|
|
|
int successCount = 0; |
|
|
|
|
@ -323,6 +415,7 @@ public class GetOtherSysDataJob {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取累计读数数据 |
|
|
|
|
* |
|
|
|
|
* @param mtCodes 点位编码列表 |
|
|
|
|
* @param mtCodeToOtherNameMap mtCode到otherName的映射关系 |
|
|
|
|
* @param realUrl 请求URL |
|
|
|
|
|