Browse Source

update 振动数据处理 添加 振动转索力 支持

pull/2/head
lucas 2 months ago
parent
commit
72d18dde47
  1. 36
      adaptors/振动to江苏省农村公路桥梁监测.go
  2. 2
      adaptors/统一采集to江苏省农村公路桥梁监测.go
  3. 4
      configFiles/config_江苏农村公路桥梁.json
  4. 1
      consumers/JSNCGLQL/config.go
  5. 3
      consumers/consumerJSNCGLQL.go

36
adaptors/振动to江苏省农村公路桥梁监测.go

@ -8,6 +8,8 @@ import (
"goInOut/models"
"goInOut/utils"
"log"
"strconv"
"strings"
"time"
)
@ -23,6 +25,12 @@ func (the Adaptor_ZD_JSNCGLQL) Transform(inTopic, rawMsg string) []NeedPush {
if err != nil {
return nil
}
lowerTopic := strings.ToLower(inTopic)
if strings.Contains(lowerTopic, "zdsl") ||
strings.Contains(lowerTopic, "cableforce") {
return the.ZDSLtoJSNCGLQL(zd)
}
return the.ZDtoJSNCGLQL(zd)
}
@ -68,6 +76,34 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZD) (result []NeedPush) {
return result
}
func (the Adaptor_ZD_JSNCGLQL) ZDSLtoJSNCGLQL(zd models.ZD) (result []NeedPush) {
Atime := time.UnixMilli(zd.Ticks)
sensorDataList := zd.ThemeValue
//获取对方系统 id
sensorCode := the.getSensorCode(strconv.Itoa(zd.SensorId))
if sensorCode == "" {
log.Printf("振动索力 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 测点id,请检查配置文件", zd.Module)
return
}
topic := fmt.Sprintf("data/%s/%s", the.BridgeCode, sensorCode)
var transBytes []byte
//1.添加时间段
transBytes = append(transBytes, the.getTimeBytes(Atime)...)
//数据值段
bs := utils.Float32ToBytes(sensorDataList[0])
transBytes = append(transBytes, bs...)
result = append(result, NeedPush{
Topic: topic,
Payload: transBytes,
})
return result
}
func (the Adaptor_ZD_JSNCGLQL) getSensorCode(rawSensorName string) string {
v, isValid := the.IdMap[rawSensorName]

2
adaptors/统一采集to江苏省农村公路桥梁监测.go

@ -55,7 +55,7 @@ func (the Adaptor_TYCJ_JSNCGLQL) TYCJtoJSNCGLQL(tycj models.TYCJ) (result []Need
for _, sensorData := range sensorDataList {
//4.添加数据值段
//添加数据值段
bs := utils.Float32ToBytes(sensorData)
transBytes = append(transBytes, bs...)
}

4
configFiles/config_江苏农村公路桥梁.json

@ -11,6 +11,7 @@
"Topics": [
"upload/uds/+",
"upload/ZD/+",
"upload/ZDSL/+",
"upload/gdnd/+"
]
}
@ -40,6 +41,9 @@
"m1c1": "LHTDQ-VIB-C08-001-01",
"m1c2": "LHTDQ-VIB-L03-001-01"
},
"ZDSLensorMap": {
"333701": "LHTDQ-SL-C08-001-01"
},
"GDNDsensorMap": {
"DY-DIS-ZG03-01": "LHTDQ-GDND-G03-003-01",
"m3c2": "LHTDQ-GDND-G03-003-02"

1
consumers/JSNCGLQL/config.go

@ -24,6 +24,7 @@ type SensorConfig struct {
TYCJsensorMap map[string]string `json:"TYCJsensorMap"`
ZDsensorMap map[string]string `json:"ZDsensorMap"`
GDNDsensorMap map[string]string `json:"GDNDsensorMap"`
ZDSLensorMap map[string]string `json:"ZDSLensorMap"`
}
type SensorInfo struct {

3
consumers/consumerJSNCGLQL.go

@ -116,6 +116,9 @@ func (the *consumerJSNCGLQL) getAdaptor(flag string) (adaptor adaptors.IAdaptor4
case "upload/ZD":
log.Printf("[振动软件]-上报,准备处理")
adaptor = adaptors.Adaptor_ZD_JSNCGLQL{IdMap: the.Info.ZDsensorMap, BridgeCode: bridgeCode}
case "upload/ZDSL":
log.Printf("[振动索力软件]-上报,准备处理")
adaptor = adaptors.Adaptor_ZD_JSNCGLQL{IdMap: the.Info.ZDSLensorMap, BridgeCode: bridgeCode}
case "upload/gdnd":
log.Printf("[光电挠度]-上报,准备处理")
adaptor = adaptors.Adaptor_GDND2LA_JSNCGLQL{IdMap: the.Info.GDNDsensorMap, BridgeCode: bridgeCode}

Loading…
Cancel
Save