Browse Source

知物云河北公路增加监测因素处理

dev
zhangyuxiang 1 week ago
parent
commit
8e1d7f82ca
  1. 36
      adaptors/知物云es主题特征to河北公路设施监测.go
  2. 118
      configFiles/config_河北省公路基础设施监测_知物云_轻量化特征数据.yaml
  3. 0
      configFiles/弃用备份/config_知物云测点数据_最新同步.yaml
  4. 1
      consumers/HBJCAS/dataModel.go
  5. 5
      consumers/consumerZWYHBJCAS.go
  6. 46
      utils/anxinyunEsAggQuery.go

36
adaptors/知物云es主题特征to河北公路设施监测.go

@ -89,18 +89,26 @@ func (the Adaptor_ZWYES_HBGL) EsAggTopToHBJCAS(structId int64, factorId int, esA
}
func (the Adaptor_ZWYES_HBGL) getMonitorTypeByFactorId(factorId int) protoFiles_hb.MonitoryType {
//拱顶沉降 102 桥墩转角 1914 挠度 1917 横向加速度 1919 纵向加速度 1920
//隧道 拱顶沉降 102
//边坡 雨量 55 表面位移62
//桥梁 桥墩转角 1914 挠度 19 挠度 1917 横向加速度 1919 纵向加速度 1920 竖向加速度 1944
switch factorId {
case 55:
return protoFiles_hb.MonitoryType_PWS
case 62:
return protoFiles_hb.MonitoryType_DBWY
case 102:
return protoFiles_hb.MonitoryType_GDCJ
case 1914:
return protoFiles_hb.MonitoryType_INC
case 1917:
case 19, 1917:
return protoFiles_hb.MonitoryType_HPT
case 1919:
return protoFiles_hb.MonitoryType_VIB
case 1920:
return protoFiles_hb.MonitoryType_VIB
case 1944:
return protoFiles_hb.MonitoryType_VIB
default:
log.Printf("factorId=%d,无匹配的MonitorType", factorId)
return protoFiles_hb.MonitoryType_CMM
@ -118,6 +126,10 @@ func (the Adaptor_ZWYES_HBGL) EsAgg2StatisticData(factorId int, monitorCode int6
avgValueY := dateBucket.Y.Avg
rootMeanSquareY := math.Sqrt(dateBucket.Y.SumOfSquares / float64(dateBucket.Y.Count))
maxAbsoluteValueZ := max(math.Abs(dateBucket.Z.Max), math.Abs(dateBucket.Z.Min))
avgValueZ := dateBucket.Z.Avg
rootMeanSquareZ := math.Sqrt(dateBucket.Z.SumOfSquares / float64(dateBucket.Z.Count))
monitoryType := the.getMonitorTypeByFactorId(factorId)
dataDefinitionStatisticData := &protoFiles_hb.DataDefinition_StatisticData{
StatisticData: &protoFiles_hb.StatisticData{
@ -130,6 +142,22 @@ func (the Adaptor_ZWYES_HBGL) EsAgg2StatisticData(factorId int, monitorCode int6
//拱顶沉降 102 桥墩转角 1914 挠度 1917 横向加速度 1919 纵向加速度 1920
switch factorId {
case 55: //雨量
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Pws{Pws: &protoFiles_hb.PWSStatistic{
AvgValue: float32(avgValueX),
}}
case 62: //表面位移
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Dbwy{Dbwy: &protoFiles_hb.DBWYStatistic{
MaxAbsoluteValueX: float32(maxAbsoluteValueX),
AvgValueX: float32(avgValueX),
RootMeanSquareX: float32(rootMeanSquareX),
MaxAbsoluteValueY: float32(maxAbsoluteValueY),
AvgValueY: float32(avgValueY),
RootMeanSquareY: float32(rootMeanSquareY),
MaxAbsoluteValueZ: float32(maxAbsoluteValueZ),
AvgValueZ: float32(avgValueZ),
RootMeanSquareZ: float32(rootMeanSquareZ),
}}
case 102: //拱顶沉降
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Gdcj{Gdcj: &protoFiles_hb.GDCJStatistic{
MaxAbsoluteValue: float32(maxAbsoluteValueX),
@ -146,13 +174,13 @@ func (the Adaptor_ZWYES_HBGL) EsAgg2StatisticData(factorId int, monitorCode int6
AvgValueY: float32(avgValueY),
RootMeanSquareY: float32(rootMeanSquareY),
}}
case 1917: //挠度
case 19, 1917: //挠度
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Hpt{Hpt: &protoFiles_hb.HPTStatistic{
MaxAbsoluteValue: float32(maxAbsoluteValueX),
AvgValue: float32(avgValueX),
RootMeanSquare: float32(rootMeanSquareX),
}}
case 1919, 1920: //振动
case 1919, 1920, 1944: //振动
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Vib{Vib: &protoFiles_hb.VIBStatistic{
MaxAbsoluteValue: float32(maxAbsoluteValueX),
RootMeanSquare: float32(rootMeanSquareY),

118
configFiles/config_河北省公路基础设施监测_知物云_轻量化特征数据.yaml

@ -0,0 +1,118 @@
consumer: consumerZWYHBJCAS
ioConfig:
in:
http:
url: https://esproxy.anxinyun.cn/savoir_themes/_search
kafka:
brokers:
- 10.8.30.160:30992
groupId: anxinHebeiGL_01
topics:
- savoir_alarm
out:
mqtt:
host: 123.249.81.52
port: 8883
userName: bs1321
password: 9$TyND#ec$aZFfcl
clientId: zhangjiakouJTYS
topics:
- t/province/1321
monitor:
#振动是触发式,数据迟缓 cron10min也改成1小时一次 最多上报6条,不进行10min实时上报
cron10min: 6/10 * * * *
#普通类型 特征数据
cron1hour: 45 0/1 * * *
#推送摄像机状态 1小时
camera1hour: 0 0/1 * * *
#普推送健康度 24小时,每天8点执行
health24hour: 0 8 * * *
info:
urlIndex: https://hbjcas.hebitt.com/pms/api/v2/bsi/
secretKey: CrAd7tkSDXKt7dyk6ueY4OeWRnSHJhUa
rc4key: CrAd7tkSDXKt7dyk6ueY4OeWRnSHJhUa3Al3
systemID: 1321
queryComponent:
redis:
address: 10.8.30.160:30379
#结构物id对应
structInfo:
8926: 130830
8928: 130831
8929: 130832
8930: 130833
8921: 130834
8922: 130835
8923: 130836
8931: 130837
8932: 130838
8936: 136137
8940: 136139
8939: 136141
8938: 136142
8935: 136144
8967: 130812
8966: 130934
8968: 138198
#点位id对应信息
pointInfo: #测点类型支持 桥墩倾斜 15 裂缝18 支座位移20 桥面振动28
#定义http接口用于对外调用
httpServer: 0.0.0.0:8425
#需要上报健康度的(桥梁|隧道|边坡)唯一编码
codeInfo:
- 130812
- 130830
- 130831
- 130832
- 130833
- 130834
- 130835
- 130836
- 130837
- 130838
- 130934
- 136137
- 136138
- 136139
- 136140
- 136141
- 136142
- 136143
- 136144
- 136145
- 138198
cameraInfo:
- 13083099901
- 13083099902
- 13083199903
- 13083199904
- 13083299905
- 13083299906
- 13083399907
- 13083399908
- 13083499909
- 13083599910
- 13083699911
- 13083699912
- 13083799913
- 13083799914
- 13083899915
- 13083899916
- 13613799917
- 13613799918
- 13613899919
- 13613899920
- 13613999921
- 13613999922
- 13614099923
- 13614099924
- 13614199925
- 13614199926
- 13614299927
- 13614299928
- 13614399929
- 13614399930
- 13614499931
- 13614499932
- 13614599933
- 13614599934

0
configFiles/config_知物云测点数据_最新同步.yaml → configFiles/弃用备份/config_知物云测点数据_最新同步.yaml

1
consumers/HBJCAS/dataModel.go

@ -44,6 +44,7 @@ type BucketsX struct {
type BucketsXY struct {
BucketsX
Y ExtendedStats `json:"y"`
Z ExtendedStats `json:"z"`
}
type ExtendedStats struct {

5
consumers/consumerZWYHBJCAS.go

@ -16,7 +16,6 @@ import (
"goInOut/models"
"goInOut/monitors"
"goInOut/utils"
"gopkg.in/yaml.v3"
"io"
"io/ioutil"
"log"
@ -176,7 +175,7 @@ func (the *consumerZWYHBJCAS) getStructIds() []int64 {
func (the *consumerZWYHBJCAS) getEs1HourAggData() {
start, end := utils.GetTimeRangeByHour(-1)
log.Printf("查询数据时间范围 %s - %s", start, end)
hourFactorIds := []int{102, 1914, 1917}
hourFactorIds := []int{62, 102, 1914, 19, 1917}
structIds := the.getStructIds()
for _, structId := range structIds {
for _, factorId := range hourFactorIds {
@ -204,7 +203,7 @@ func (the *consumerZWYHBJCAS) getEs10minAggData() {
//utils.GetTimeRangeBy10min() 由于振动数据实时性问题 改用一小时统一上报
start, end := utils.GetTimeRangeByHour(-1)
log.Printf("查询10min数据时间范围 %s - %s", start, end)
factorIds := []int{1919, 1920}
factorIds := []int{55, 1919, 1920, 1944}
structIds := the.getStructIds()
for _, structId := range structIds {
for _, factorId := range factorIds {

46
utils/anxinyunEsAggQuery.go

@ -86,6 +86,34 @@ func GetEsAggSubSqlByAxyFactorId(factorId int) string {
"field": "data.z_acc_speed"
}
}
}`
case 55:
subAggSQl = `
{
"x": {
"extended_stats": {
"field": "data.rainfall"
}
}
}`
case 62:
subAggSQl = `
{
"x": {
"extended_stats": {
"field": "data.x"
}
},
"y": {
"extended_stats": {
"field": "data.y"
}
},
"z": {
"extended_stats": {
"field": "data.z"
}
}
}`
case 102:
subAggSQl = `
@ -109,6 +137,15 @@ func GetEsAggSubSqlByAxyFactorId(factorId int) string {
"field": "data.y"
}
}
}`
case 19:
subAggSQl = `
{
"x": {
"extended_stats": {
"field": "data.deflection"
}
}
}`
case 1917:
subAggSQl = `
@ -136,6 +173,15 @@ func GetEsAggSubSqlByAxyFactorId(factorId int) string {
"field": "data.yAcc"
}
}
}`
case 1944:
subAggSQl = `
{
"x": {
"extended_stats": {
"field": "data.zAcc"
}
}
}`
}
return subAggSQl

Loading…
Cancel
Save