This commit is contained in:
zhouhuang 2024-12-11 10:30:42 +08:00
commit d6d7ad1bd1
9 changed files with 127 additions and 88 deletions

View File

@ -8,11 +8,13 @@ import com.das.modules.cache.service.CacheService;
import com.das.modules.node.constant.NodeConstant;
import com.das.modules.node.domain.bo.TerminalMessage;
import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
@Slf4j
@Service(value = NodeConstant.HEARTBEAT)
public class HeartbeatCommand implements BaseCommand{
@ -49,20 +51,22 @@ public class HeartbeatCommand implements BaseCommand{
if (devices != null && devices.isArray()) {
for (JsonNode device : devices) {
Long deviceId = device.get("deviceId").asLong();
Boolean online = device.get("online").asBoolean();
int online = device.get("online").asInt();
DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId);
if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) {
continue;
}
//判断是不是风机
String keyPLCDeviceStatus = String.format("RT:%d:iturbineoperationmode", deviceId);
String keyCommFaultState = String.format("RT:%d:commfaultstate",deviceId);
Integer plcDeviceStatus = adminRedisTemplate.get(keyPLCDeviceStatus);
log.debug("设备ID:{},在线状态:{},通讯状态: {}", deviceId, online, plcDeviceStatus);
if (plcDeviceStatus == null){
adminRedisTemplate.set(keyCommFaultState, online ? 0 : 1);
adminRedisTemplate.set(keyCommFaultState, (online == 1) ? 0 : 1);
}
else{
adminRedisTemplate.set(keyCommFaultState, online && plcDeviceStatus != 0 ? 0 : 1);
adminRedisTemplate.set(keyCommFaultState, (online == 1) && (plcDeviceStatus != 0) ? 0 : 1);
}
}
}

View File

@ -238,8 +238,10 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
@Override
public void handleData(TerminalMessage data) {
JsonNode jsonNode = data.getData();
log.info("收到消息:{}",data.getData());
String deviceId = jsonNode.get("deviceId").asText();
JsonNode values = jsonNode.get("values");
JsonNode archiveValues = jsonNode.get("archiveValues");
Long dataTime = jsonNode.get("dataTime").asLong();
Map<String, Object> keyValueMap = new HashMap<>();
String modelCode = dataService.deviceModelMap.get(deviceId);
@ -254,6 +256,13 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
String fieldName = keysHigh.next();
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
keyValueMap.put(key, values.get(fieldName));
}
log.info("values解析成功");
Iterator<String> archiveKeys = archiveValues.fieldNames();
while (archiveKeys.hasNext()) {
String fieldName = archiveKeys.next();
String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase());
keyValueMap.put(key, values.get(fieldName));
if (highKey.contains(fieldName)) {
highSpeedValueMap.put(fieldName, values.get(fieldName));
}
@ -261,8 +270,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
lowSpeedValueMap.put(fieldName, values.get(fieldName));
}
}
adminRedisTemplate.mSet(keyValueMap);
if (jsonNode.get("isStore") != null && jsonNode.get("isStore").asBoolean()) {
log.info("archive解析成功");
//更新td
if (!highSpeedValueMap.isEmpty()) {
List<RTData> highSpeedData = new ArrayList<>();
@ -277,7 +285,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node
lowSpeedData.add(rtLowData);
tdEngineService.updateYCLowValues(lowSpeedData, modelCode);
}
}
adminRedisTemplate.mSet(keyValueMap);
}
@Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

View File

@ -118,7 +118,7 @@
<div class="btnLeft">
<el-button
@click="sendCommand('setTurbineFastStart')"
v-if="realTimeData.iturbineoperationmode !== 16"
v-if="realTimeData.processedoperationmode !== 16"
class="control-btn"
type="primary"
>启动</el-button
@ -356,7 +356,7 @@ let timer: any = null
let myTable = ref<TableInstance>()
const overviewData = reactive({
// iturbineoperationmode: '-',
// processedoperationmode: '-',
iwindspeed: '-',
iwinddirection: '-',
igenspeed: '-',
@ -963,12 +963,12 @@ const createScroll = () => {
}
const realTimeData = ref<any>({
iturbineoperationmode: 1111,
processedoperationmode: 1111,
locked: 0,
})
const realTimeDataState = computed(() => {
switch (realTimeData.value.iturbineoperationmode) {
switch (realTimeData.value.processedoperationmode) {
case 20:
return '并网'
case 10:
@ -1015,7 +1015,7 @@ const createRealTimeData = async () => {
try {
const modelList: any = await getModelList()
const realData: any = await getRealTimeData()
realTimeData.value.iturbineoperationmode = getRealTimeState(realData)
realTimeData.value.processedoperationmode = getRealTimeState(realData)
realTimeData.value.locked = realData.locked
temperatureChartsData[0].value = getCutDecimalsValue(realData.itempoutdoor_1sec)

View File

@ -6,7 +6,14 @@
<div class="airBlowerList">
<div class="title">风机列表</div>
<el-table class="table" :data="tableData">
<el-table-column v-for="item in tableColumn" :key="item.prop" :prop="item.prop" :label="item.label" align="center">
<el-table-column
v-for="item in tableColumn"
:key="item.prop"
:prop="item.prop"
:label="item.label"
align="center"
:width="item.width"
>
<template #default="scope">
<div v-if="item.prop === 'iturbineoperationmode'">
<el-tag v-if="scope.row.locked === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731">已锁定</el-tag>
@ -110,7 +117,7 @@
</div>
</div>
<div class="bottom">
<el-input placeholder="本地目标值设置MW 请输入">
<el-input v-model="agcTargetValue" placeholder="本地目标值设置MW 请输入">
<template #suffix>
<div class="saveBtn"></div>
</template>
@ -200,7 +207,7 @@
</div>
</div>
<div class="bottom">
<el-input placeholder="本地目标值设置MW 请输入">
<el-input v-model="avcTargetValue" placeholder="本地目标值设置MW 请输入">
<template #suffix>
<div class="saveBtn"></div>
</template>
@ -255,11 +262,13 @@ import { getAirBlowerListReq } from '/@/api/backend/airBlower/request'
import { getRealValueListReq, getRealValueRangeReq } from '/@/api/backend/deviceModel/request'
import { getRealTimeState, getCutDecimalsValue, getEnumToValue } from '/@/views/backend/equipment/airBlower/utils'
import { ElMessage, dayjs } from 'element-plus'
import { debounce } from 'lodash-es'
import * as echarts from 'echarts'
const agcOnoffSwitch = ref(true)
const agcOnOff = ref(true)
const agcLocalRemoteSwitch = ref(false)
const agcTargetValue = ref()
const agcAdd = ref(true)
const agcSub = ref(false)
const agcRecordList = ref([
@ -273,6 +282,7 @@ const agcRecordList = ref([
const avcOnoffSwitch = ref(true)
const avcOnOff = ref(false)
const avcLocalRemoteSwitch = ref(false)
const avcTargetValue = ref()
const avcAdd = ref(true)
const avcSub = ref(false)
const avcRecordList = ref([
@ -287,34 +297,42 @@ const tableColumn = [
{
label: '编号',
prop: 'name',
width: '',
},
{
label: '风速m/s',
prop: 'iwindspeed',
width: '',
},
{
label: '转速rmp',
prop: 'igenspeed',
width: '',
},
{
label: '有功kW',
prop: 'igenpower',
width: '',
},
{
label: '有功给定kW',
prop: 'iactivepowersetpointvalue',
width: '',
},
{
label: '无功kVar',
prop: 'ireactivepower',
width: '',
},
{
label: '无功给定kVar',
prop: 'ireactivepowersetpointvalue',
width: '',
},
{
label: '状态',
prop: 'iturbineoperationmode',
width: '',
},
]
@ -541,7 +559,6 @@ const createChartData = (data: { [k: string]: number }, time: string) => {
if (realDataSeries.length) {
const seriesItem = realDataSeries.find((series) => series.id === item)
console.log(seriesItem, '------------------')
seriesItem.data.push(curVal)
return seriesItem
} else {
@ -780,16 +797,23 @@ const getContainerHeight = () => {
containerHeight.value = `${height}px`
}
}
const resizeChart = debounce(() => {
chartInstance?.resize()
}, 500)
const resizeFn = () => {
resizeChart()
getContainerHeight()
}
onMounted(() => {
getContainerHeight()
autoUpdateAirBlower()
nextTick(() => {
createChart()
})
window.addEventListener('resize', getContainerHeight)
window.addEventListener('resize', resizeFn)
})
onUnmounted(() => {
window.removeEventListener('resize', getContainerHeight)
window.removeEventListener('resize', resizeFn)
timer && clearInterval(timer)
})
</script>
@ -1000,6 +1024,7 @@ onUnmounted(() => {
@include record;
}
.centerContainer {
margin-bottom: 20px;
height: v-bind('containerHeight');
color: #4e5969;
.airBlowerList {
@ -1032,7 +1057,7 @@ onUnmounted(() => {
}
.lineChart {
width: 100%;
height: calc(100% - 132px);
height: calc(100% - 102px);
.chart {
width: 100%;
height: 100%;
@ -1043,7 +1068,7 @@ onUnmounted(() => {
flex-wrap: wrap;
padding: 10px;
width: 100%;
height: 100px;
height: 70px;
background-color: #f0f6ff;
.infoItem {
display: flex;

View File

@ -6,13 +6,13 @@
<div class="selectPart">
<span>{{ t('airBlower.status') }}</span>
<el-select
v-model="airBlowerSelect.iturbineoperationmode"
@change="selectAirBlower('iturbineoperationmode')"
v-model="airBlowerSelect.processedoperationmode"
@change="selectAirBlower('processedoperationmode')"
:placeholder="'请选择' + t('airBlower.status')"
class="airBlowerSelect"
>
<el-option
v-for="v in airBlowerSelectOptions.iturbineoperationmode"
v-for="v in airBlowerSelectOptions.processedoperationmode"
:key="v.value"
:label="v.label"
:value="v.value"
@ -87,39 +87,39 @@
/>
<el-table-column v-else :label="item.label" :align="item.align" :width="item.width">
<template v-if="item.custom === 'default'" #default="scope">
<div v-if="item.prop === 'iturbineoperationmode'">
<div v-if="item.prop === 'processedoperationmode'">
<el-tag v-if="scope.row.locked === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731">已锁定</el-tag>
<el-tag v-if="scope.row.iturbineoperationmode === 20" color="rgba(0,100,170,0.20)" style="color: #0064aa"
<el-tag v-if="scope.row.processedoperationmode === 20" color="rgba(0,100,170,0.20)" style="color: #0064aa"
>并网</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 10" color="rgba(0,160,150,0.20)" style="color: #00a096"
<el-tag v-if="scope.row.processedoperationmode === 10" color="rgba(0,160,150,0.20)" style="color: #00a096"
>维护</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 8" color="rgba(255,126,0,0.20)" style="color: #ff7e00"
<el-tag v-if="scope.row.processedoperationmode === 8" color="rgba(255,126,0,0.20)" style="color: #ff7e00"
>限功率运行</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 0" color="rgba(153,153,153,0.20)" style="color: #666666"
<el-tag v-if="scope.row.processedoperationmode === 0" color="rgba(153,153,153,0.20)" style="color: #666666"
>离线</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 16" color="rgba(6,180,41,0.20)" style="color: #06b429"
<el-tag v-if="scope.row.processedoperationmode === 16" color="rgba(6,180,41,0.20)" style="color: #06b429"
>启动</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 6" color="rgba(254,55,49,0.20)" style="color: #fe3731"
<el-tag v-if="scope.row.processedoperationmode === 6" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>正常停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731"
<el-tag v-if="scope.row.processedoperationmode === 1" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>外部因素导致停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 2" color="rgba(254,55,49,0.20)" style="color: #fe3731"
<el-tag v-if="scope.row.processedoperationmode === 2" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>停机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 11" color="rgba(255,182,0,0.20)" style="color: #ffb600"
<el-tag v-if="scope.row.processedoperationmode === 11" color="rgba(255,182,0,0.20)" style="color: #ffb600"
>待机</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1110" color="rgba(153,153,153,0.20)" style="color: #666666"
<el-tag v-if="scope.row.processedoperationmode === 1110" color="rgba(153,153,153,0.20)" style="color: #666666"
>解缆状态</el-tag
>
<el-tag v-if="scope.row.iturbineoperationmode === 1111" color="rgba(254,55,49,0.20)" style="color: #fe3731"
<el-tag v-if="scope.row.processedoperationmode === 1111" color="rgba(254,55,49,0.20)" style="color: #fe3731"
>电网故障停机</el-tag
>
</div>
@ -226,12 +226,12 @@ const router = useRouter()
const { t } = useI18n()
const airBlowerSelect = reactive<SelectTypeObjType>({
iturbineoperationmode: 987654321,
processedoperationmode: 987654321,
belongLine: '全部',
})
const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnionType]: { label: string; value: string | number }[] }>({
iturbineoperationmode: [
processedoperationmode: [
{
label: '全部',
value: 987654321,
@ -289,33 +289,33 @@ const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnionType]: { label
})
const selectAirBlower = (type: SelectTypeKeyUnionType) => {
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.processedoperationmode === 987654321) {
tableData.value = originTableData.value
return
} else if (airBlowerSelect.belongLine !== '全部' && airBlowerSelect.iturbineoperationmode !== 987654321) {
if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 2) {
const type1 = originTableData.value.filter((item) => item.iturbineoperationmode === 1)
const type6 = originTableData.value.filter((item) => item.iturbineoperationmode === 6)
const type2 = originTableData.value.filter((item) => item.iturbineoperationmode === 2)
} else if (airBlowerSelect.belongLine !== '全部' && airBlowerSelect.processedoperationmode !== 987654321) {
if (type === 'processedoperationmode' && airBlowerSelect.processedoperationmode === 2) {
const type1 = originTableData.value.filter((item) => item.processedoperationmode === 1)
const type6 = originTableData.value.filter((item) => item.processedoperationmode === 6)
const type2 = originTableData.value.filter((item) => item.processedoperationmode === 2)
const typeAll = [...type1, ...type6, ...type2]
tableData.value = typeAll.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
}
const resData = originTableData.value.filter((item) => item.iturbineoperationmode === airBlowerSelect.iturbineoperationmode)
const resData = originTableData.value.filter((item) => item.processedoperationmode === airBlowerSelect.processedoperationmode)
tableData.value = resData.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
} else {
if (type === 'belongLine' && airBlowerSelect.belongLine === '全部') {
tableData.value = originTableData.value.filter((item) => item.iturbineoperationmode === airBlowerSelect.iturbineoperationmode)
tableData.value = originTableData.value.filter((item) => item.processedoperationmode === airBlowerSelect.processedoperationmode)
return
} else if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 987654321) {
} else if (type === 'processedoperationmode' && airBlowerSelect.processedoperationmode === 987654321) {
tableData.value = originTableData.value.filter((item) => item.belongLine === airBlowerSelect.belongLine)
return
}
if (type === 'iturbineoperationmode' && airBlowerSelect.iturbineoperationmode === 2) {
const type1 = originTableData.value.filter((item) => item.iturbineoperationmode === 1)
const type6 = originTableData.value.filter((item) => item.iturbineoperationmode === 6)
const type2 = originTableData.value.filter((item) => item.iturbineoperationmode === 2)
if (type === 'processedoperationmode' && airBlowerSelect.processedoperationmode === 2) {
const type1 = originTableData.value.filter((item) => item.processedoperationmode === 1)
const type6 = originTableData.value.filter((item) => item.processedoperationmode === 6)
const type2 = originTableData.value.filter((item) => item.processedoperationmode === 2)
tableData.value = [...type1, ...type6, ...type2]
return
}
@ -396,7 +396,7 @@ const defaultColumn: TableColumnType[] = [
},
{
label: '风机状态',
prop: 'iturbineoperationmode',
prop: 'processedoperationmode',
align: 'center',
custom: 'default',
width: 100,
@ -522,7 +522,7 @@ const createTableReqParams = (airblowerList: { irn: string; name: string }[]) =>
airBlowerIds.push(item.irn)
return {
deviceId: item.irn,
attributes: [...curTableKey, 'iturbineoperationmode', 'iyplevel', 'gridlostdetected', 'ibplevel'],
attributes: [...curTableKey, 'processedoperationmode', 'iyplevel', 'gridlostdetected', 'ibplevel'],
}
})
return { params, airBlowerInfo, airBlowerIds }
@ -560,12 +560,12 @@ const getTableData = () => {
belongLine: airBlowerInfoObj[id].belongLine,
deviceCode: airBlowerInfoObj[id].deviceCode,
...realData,
iturbineoperationmode: state,
processedoperationmode: state,
}
})
originTableData.value = data
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.iturbineoperationmode === 987654321) {
if (airBlowerSelect.belongLine === '全部' && airBlowerSelect.processedoperationmode === 987654321) {
tableData.value = data
} else {
const irn = tableData.value.map((item) => item.irn)

View File

@ -1,5 +1,5 @@
export type SelectTypeObjType = {
iturbineoperationmode?: number
processedoperationmode?: number
belongLine: string
}
export type SelectTypeKeyUnionType = keyof SelectTypeObjType
@ -12,7 +12,7 @@ export type TableDataObjType = {
name: string
model: string
iotModelId: string
iturbineoperationmode: number
processedoperationmode: number
belongLine: string
iwindspeed: string
igenpower: string

View File

@ -3,14 +3,14 @@ import { useEnumStore } from '/@/stores/enums'
const enumStore = useEnumStore()
export const getRealTimeState = (data: any) => {
if (data.iturbineoperationmode) {
if (data.iturbineoperationmode > 1 && data.iturbineoperationmode < 6) {
if (data.processedoperationmode) {
if (data.processedoperationmode > 1 && data.processedoperationmode < 6) {
return 2
}
if (data.iturbineoperationmode === 21) {
if (data.processedoperationmode === 21) {
return 20
}
return data.iturbineoperationmode
return data.processedoperationmode
} else if (data.iyplevel === 10) {
return 1110
} else if (data.gridlostdetected === 1) {

View File

@ -254,6 +254,8 @@ const getCompleteData = () => {
: realValItem.toFixed(3)
: '-'
: realValItem
: realValItem == 0
? 0
: '-',
}
})