diff --git a/das/src/main/java/com/das/modules/calc/service/CalcService.java b/das/src/main/java/com/das/modules/calc/service/CalcService.java index c9669f0e..3b1ed193 100644 --- a/das/src/main/java/com/das/modules/calc/service/CalcService.java +++ b/das/src/main/java/com/das/modules/calc/service/CalcService.java @@ -138,6 +138,9 @@ public class CalcService { FunctionWindSpeedFactor windSpeedFactor = new FunctionWindSpeedFactor(dataService,cacheService); aviator.addFunction(windSpeedFactor); + + FunctionIsOnline isOnline = new FunctionIsOnline(adminRedisTemplate, cacheService); + aviator.addFunction(isOnline); } /** diff --git a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java index 59281e29..f4500301 100644 --- a/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java +++ b/das/src/main/java/com/das/modules/node/command/HeartbeatCommand.java @@ -2,7 +2,6 @@ package com.das.modules.node.command; import com.das.common.constant.EquipmentTypeIds; import com.das.common.utils.AdminRedisTemplate; -import com.das.common.utils.StringUtils; import com.das.modules.cache.domain.DeviceInfoCache; import com.das.modules.cache.service.CacheService; import com.das.modules.node.constant.NodeConstant; @@ -12,44 +11,57 @@ 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{ - public static final long HEARTBEAT_TTL = 60L; + public static final long HEARTBEAT_TTL = 12L; @Autowired AdminRedisTemplate adminRedisTemplate; @Autowired CacheService cacheService; + /** + * 执行命令方法 + * 该方法处理接收到的终端消息,特别是心跳报文中的设备和链路在线状态更新 + * + * @param data 包含心跳报文信息的TerminalMessage对象 + */ @Override public void doCommand(TerminalMessage data) { + log.info("收到[heartbeat]报文"); + + // 解析心跳报文中的数据信息 JsonNode dataInfo = data.getData(); if (!dataInfo.isEmpty()) { + // 处理链路信息 JsonNode links = data.getData().get("links"); if (links != null && links.isArray()) { for (JsonNode linkNode : links) { String linkId = linkNode.get("linkId").asText(); boolean online = linkNode.get("online").asBoolean(); - String key = String.format("link:%d:online", linkId, online); + String key = String.format("link:%s:online", linkId); + // 更新链路在线状态到Redis adminRedisTemplate.set(key, online ? 1 : 0); adminRedisTemplate.expire(key, HEARTBEAT_TTL); } } + + // 处理设备信息 JsonNode devices = data.getData().get("devices"); if (devices != null && devices.isArray()) { for (JsonNode device : devices) { long deviceId = device.get("deviceId").asLong(); boolean online = device.get("online").asBoolean(); + // 获取设备缓存信息 DeviceInfoCache deviceInfoCacheById = cacheService.getEquipmentCache().getDeviceInfoCacheById(deviceId); if (deviceInfoCacheById == null || !deviceInfoCacheById.getObjectType().equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG)) { continue; } - //判断是不是风机 + // 判断是不是风机 String keyDeviceOnline = String.format("device:%d:online", deviceId); + // 更新设备在线状态到Redis adminRedisTemplate.set(keyDeviceOnline, online ? 1 : 0); adminRedisTemplate.expire(keyDeviceOnline, HEARTBEAT_TTL); @@ -57,6 +69,7 @@ public class HeartbeatCommand implements BaseCommand{ 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); } diff --git a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java index 871df869..3192ac98 100644 --- a/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java +++ b/das/src/main/java/com/das/modules/node/service/impl/NodeMessageServiceImpl.java @@ -238,7 +238,7 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node @Override public void handleData(TerminalMessage data) { JsonNode jsonNode = data.getData(); - log.info("收到消息:{}",data.getData()); + log.debug("收到消息:{}",data.getData()); String deviceId = jsonNode.get("deviceId").asText(); JsonNode values = jsonNode.get("values"); JsonNode archiveValues = jsonNode.get("archiveValues"); @@ -258,7 +258,6 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node String key = String.format("RT:%s:%s", deviceId, fieldName.toLowerCase()); keyValueMap.put(key, values.get(fieldName)); } - log.info("values解析成功"); } if (archiveValues != null){ @@ -274,7 +273,6 @@ public class NodeMessageServiceImpl extends TextWebSocketHandler implements Node lowSpeedValueMap.put(fieldName, archiveValues.get(fieldName)); } } - log.info("archive解析成功"); } //更新td if (!highSpeedValueMap.isEmpty()) { diff --git a/docs/deploy/asserts/image-4.png b/docs/deploy/asserts/image-4.png new file mode 100644 index 00000000..b9fa038a Binary files /dev/null and b/docs/deploy/asserts/image-4.png differ diff --git a/docs/deploy/das.md b/docs/deploy/das.md index 51469e3b..e545cb0a 100644 --- a/docs/deploy/das.md +++ b/docs/deploy/das.md @@ -462,8 +462,62 @@ systemctl enable das ```shell mkdir -p /das/app cd /das/app -wget https://oss.jsspisoft.com/ +wget https://oss.jsspisoft.com/public/software/das/das-dn.tar.gz +tar zxvf das-dn.tar.gz +rm -f das-dn.tar.gz ``` +### 程序配置 +编辑文件`/das/app/das-dn/envfile` +```toml +#das服务地址 +ISS_WS_HOST=127.0.0.1 +#das服务端口 +ISS_WS_PORT=8080 +#节点ID +ISS_WS_NODEID=1 +``` + +### 配置服务 + +创建服务文件`/etc/systemd/system/das-dn.service`,内容如下: + +```toml +[Unit] +Description=DAS DN Service +After=network.target + +[Service] +Type=simple +EnvironmentFile=/das/app/das-dn/envfile +ExecStart=/das/app/das-dn/bin/application -d ./rtufiles -h $ISS_WS_HOST -p $ISS_WS_PORT -n $ISS_WS_NODEID +Restart=always +RestartSec=10 +StartLimitInterval=0 +WorkingDirectory=/das/app/das-dn + +[Install] +WantedBy=multi-user.target +``` + +### 服务启动 + +```bash +systemctl start das-dn +systemctl enable das-dn +``` + +## 前端UI部署 + +前端只需要部署静态文件就行了 + +```shell +mkdir -p /das/app +wget https://oss.jsspisoft.com/public/software/das/ui.tar.gz +tar zxvf ui.tar.gz +rm -f ui.tar.gz +``` + +这样就部署好了。 \ No newline at end of file diff --git a/ui/dasadmin/src/views/backend/WindBlower/index.vue b/ui/dasadmin/src/views/backend/WindBlower/index.vue index 8f9708a1..fd2c3e68 100644 --- a/ui/dasadmin/src/views/backend/WindBlower/index.vue +++ b/ui/dasadmin/src/views/backend/WindBlower/index.vue @@ -987,6 +987,8 @@ const realTimeDataState = computed(() => { return '停机' case 11: return '待机' + case 33: + return '通讯中断' case 1110: return '解缆状态' case 1111: diff --git a/ui/dasadmin/src/views/backend/dashboard.vue b/ui/dasadmin/src/views/backend/dashboard.vue index 726d2645..de45cb83 100644 --- a/ui/dasadmin/src/views/backend/dashboard.vue +++ b/ui/dasadmin/src/views/backend/dashboard.vue @@ -341,23 +341,6 @@ const currentDayStatus = ref({ }) const deviceCode = ref([]) const FanList = ref([]) -const getRealTimeState = (data: any) => { - if (data.iturbineoperationmode) { - if (data.iturbineoperationmode > 1 && data.iturbineoperationmode < 6) { - return 2 - } - if (data.iturbineoperationmode === 21) { - return 20 - } - return data.iturbineoperationmode - } else if (data.iyplevel === 10) { - return 1110 - } else if (data.gridlostdetected === 1) { - return 1111 - } else if (data.ibplevel === 200) { - return 1112 - } -} const StatusListData = () => { getWindTurbineMatrixData().then((res) => { if (res.code == 200) { diff --git a/ui/dasadmin/src/views/backend/energyManage/index.vue b/ui/dasadmin/src/views/backend/energyManage/index.vue index 730cfd88..19e45582 100644 --- a/ui/dasadmin/src/views/backend/energyManage/index.vue +++ b/ui/dasadmin/src/views/backend/energyManage/index.vue @@ -15,41 +15,44 @@ :width="item.width" > @@ -174,7 +177,7 @@
33
-
MW
+
MVar
@@ -184,7 +187,7 @@
6
-
MW
+
MVar
@@ -227,17 +230,17 @@
-
AVC可增有功
+
AVC可增无功
5
-
MW
+
MVar
-
AVC可减有功
+
AVC可减无功
5
-
MW
+
MVar
@@ -331,7 +334,7 @@ const tableColumn = [ }, { label: '状态', - prop: 'iturbineoperationmode', + prop: 'processedoperationmode', width: '', }, ] @@ -354,7 +357,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 } @@ -393,7 +396,7 @@ const getAirBlowerList = () => { belongLine: airBlowerInfoObj[id].belongLine, deviceCode: airBlowerInfoObj[id].deviceCode, ...realData, - iturbineoperationmode: state, + processedoperationmode: state, } }) tableData.value = data diff --git a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue index 8be75286..e2f12e65 100644 --- a/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue +++ b/ui/dasadmin/src/views/backend/equipment/airBlower/index.vue @@ -122,6 +122,9 @@ 电网故障停机 + 通讯中断
@@ -272,6 +275,10 @@ const airBlowerSelectOptions = reactive<{ [K in SelectTypeKeyUnionType]: { label label: '停机', value: 2, }, + { + label: '通讯中断', + value: 33, + }, { label: '解缆状态', value: 1110, diff --git a/ui/dasadmin/src/views/backend/home/windMatrix.vue b/ui/dasadmin/src/views/backend/home/windMatrix.vue index 5d0ae852..4504bbd8 100644 --- a/ui/dasadmin/src/views/backend/home/windMatrix.vue +++ b/ui/dasadmin/src/views/backend/home/windMatrix.vue @@ -6,32 +6,35 @@ @click="handleClick(item)" @contextmenu.prevent="windContextMenu($event,item)" > -
-
- - +
+ +
+ + {{ item.name }} 并网 待机 启动 维护 + >维护 离线 限功率运行 正常停机 外部因素导致停机 + >外部因素导致停机 停机 解缆状态 电网故障停机 + >电网故障停机 安全链停机 + >安全链停机 + 通讯中断
@@ -254,6 +257,10 @@ const sendManualCommand = (type: 1 | 0) => { background-image: linear-gradient(180deg, #f0f6ff 0%, #ffffff 50%); border: 1px solid #e1edf6; } +.wind-offline { + background-image: linear-gradient(180deg, #dddddd 0%, #ffffff 93%); + border: 1px solid #eeeeee; +} .wind-picture { display: none; } diff --git a/ui/dasadmin/src/views/backend/linkMonitor/index.vue b/ui/dasadmin/src/views/backend/linkMonitor/index.vue index ac46229d..db19a60d 100644 --- a/ui/dasadmin/src/views/backend/linkMonitor/index.vue +++ b/ui/dasadmin/src/views/backend/linkMonitor/index.vue @@ -46,12 +46,7 @@ @@ -102,13 +97,13 @@