PCS关机先向设备发送给定功率值再发送关机指令

This commit is contained in:
zq
2026-01-15 17:49:03 +08:00
parent 0076872134
commit fb64be5a5a
2 changed files with 32 additions and 13 deletions

View File

@ -564,32 +564,39 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
public List<WriteTagConfig> getWriteTags(String workStatus, EmsPcsSetting pcsSetting) {
List<WriteTagConfig> writeTags = new ArrayList<>();
BigDecimal power;
WriteTagConfig writeTag = new WriteTagConfig();
writeTag.setAddress(pcsSetting.getPointAddress());
if (WorkStatus.NORMAL.getCode().equals(workStatus)) {
// 开机
// 开机先发送开机指令再发送有功功率给定值
WriteTagConfig writeTag = new WriteTagConfig();
writeTag.setAddress(pcsSetting.getPointAddress());
writeTag.setValue(pcsSetting.getStartCommand());
writeTags.add(writeTag);
power = pcsSetting.getStartPower();
} else if (WorkStatus.STOP.getCode().equals(workStatus)) {
// 关机
writeTag.setValue(pcsSetting.getStopCommand());
power = pcsSetting.getStopPower();
} else {
throw new ServiceException("工作状态不合法");
}
writeTags.add(writeTag);
JSONArray array = JSON.parseArray(pcsSetting.getClusterPointAddress());
for (int i = 0; i < pcsSetting.getClusterNum(); i++) {
Object clusterPointAddress = array.get(i);
WriteTagConfig clusterWriteTag = new WriteTagConfig();
clusterWriteTag.setAddress(String.valueOf(clusterPointAddress));
// 电池簇PCS有功功率给定置0
// 电池簇PCS有功功率给定默认置0
if (power == null) {
power = BigDecimal.ZERO;
}
clusterWriteTag.setValue(power);
writeTags.add(clusterWriteTag);
}
if (WorkStatus.STOP.getCode().equals(workStatus)) {
// 关机先发送有功功率给定值再发送关机指令
WriteTagConfig writeTag = new WriteTagConfig();
writeTag.setAddress(pcsSetting.getPointAddress());
writeTag.setValue(pcsSetting.getStopCommand());
writeTags.add(writeTag);
}
return writeTags;
}
}