|
|
@ -78,10 +78,12 @@ func (the Adaptor_AXYES_HBGL) EsAggTopToHBJCAS(structId int64, factorId int, esA |
|
|
|
return result |
|
|
|
} |
|
|
|
func (the Adaptor_AXYES_HBGL) getMonitorTypeByFactorId(factorId int) protoFiles_hb.MonitoryType { |
|
|
|
//桥墩倾斜 15 支座位移20 桥面振动28
|
|
|
|
//桥墩倾斜 15 裂缝18 支座位移20 桥面振动28
|
|
|
|
switch factorId { |
|
|
|
case 15: |
|
|
|
return protoFiles_hb.MonitoryType_INC |
|
|
|
case 18: |
|
|
|
return protoFiles_hb.MonitoryType_CRK |
|
|
|
case 20: |
|
|
|
return protoFiles_hb.MonitoryType_AND |
|
|
|
case 28: |
|
|
@ -90,14 +92,15 @@ func (the Adaptor_AXYES_HBGL) getMonitorTypeByFactorId(factorId int) protoFiles_ |
|
|
|
return protoFiles_hb.MonitoryType_CMM |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func (the Adaptor_AXYES_HBGL) EsAgg2StatisticData(factorId int, monitorCode int64, dateBucket models.BucketsXY) *protoFiles_hb.DataDefinition_StatisticData { |
|
|
|
Atime := dateBucket.KeyAsString.Add(-8 * time.Hour).UnixMilli() |
|
|
|
maxAbsoluteValueX := max(math.Abs(dateBucket.X.Max), math.Abs(dateBucket.X.Min)) |
|
|
|
avgValueX := dateBucket.X.Avg |
|
|
|
rootMeanSquareX := math.Sqrt(dateBucket.X.SumOfSquares / float64(dateBucket.X.Count)) |
|
|
|
|
|
|
|
maxAbsoluteValueY := max(math.Abs(dateBucket.Y.Max), math.Abs(dateBucket.Y.Min)) |
|
|
|
avgValueY := dateBucket.Y.Avg |
|
|
|
|
|
|
|
rootMeanSquareX := math.Sqrt(dateBucket.X.SumOfSquares / float64(dateBucket.X.Count)) |
|
|
|
rootMeanSquareY := math.Sqrt(dateBucket.Y.SumOfSquares / float64(dateBucket.Y.Count)) |
|
|
|
|
|
|
|
monitoryType := the.getMonitorTypeByFactorId(factorId) |
|
|
@ -107,17 +110,35 @@ func (the Adaptor_AXYES_HBGL) EsAgg2StatisticData(factorId int, monitorCode int6 |
|
|
|
MonitorCode: monitorCode, //测点唯一编码
|
|
|
|
EventTime: Atime, |
|
|
|
Interval: 60 * 1000, |
|
|
|
DataBody: &protoFiles_hb.StatisticData_Inc{Inc: &protoFiles_hb.INCStatistic{ |
|
|
|
MaxAbsoluteValueX: float32(maxAbsoluteValueX), |
|
|
|
AvgValueX: float32(avgValueX), |
|
|
|
RootMeanSquareX: float32(rootMeanSquareX), |
|
|
|
MaxAbsoluteValueY: float32(maxAbsoluteValueY), |
|
|
|
AvgValueY: float32(avgValueY), |
|
|
|
RootMeanSquareY: float32(rootMeanSquareY), |
|
|
|
}}, |
|
|
|
}, |
|
|
|
} |
|
|
|
|
|
|
|
switch factorId { |
|
|
|
case 15: //倾角
|
|
|
|
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Inc{Inc: &protoFiles_hb.INCStatistic{ |
|
|
|
MaxAbsoluteValueX: float32(maxAbsoluteValueX), |
|
|
|
AvgValueX: float32(avgValueX), |
|
|
|
RootMeanSquareX: float32(rootMeanSquareX), |
|
|
|
MaxAbsoluteValueY: float32(maxAbsoluteValueY), |
|
|
|
AvgValueY: float32(avgValueY), |
|
|
|
RootMeanSquareY: float32(rootMeanSquareY), |
|
|
|
}} |
|
|
|
case 18: //裂缝监测
|
|
|
|
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Crk{Crk: &protoFiles_hb.CRKStatistic{ |
|
|
|
MaxAbsoluteValue: float32(maxAbsoluteValueX), |
|
|
|
AvgValue: float32(avgValueX), |
|
|
|
RootMeanSquare: float32(rootMeanSquareX), |
|
|
|
TotalAbsoluteValue: float32(dateBucket.X.Max - dateBucket.X.Min), |
|
|
|
}} |
|
|
|
case 20: //支座位移
|
|
|
|
dataDefinitionStatisticData.StatisticData.DataBody = &protoFiles_hb.StatisticData_Dis{Dis: &protoFiles_hb.DISStatistic{ |
|
|
|
MaxAbsoluteValue: float32(maxAbsoluteValueX), |
|
|
|
AvgValue: float32(avgValueX), |
|
|
|
RootMeanSquare: float32(rootMeanSquareX), |
|
|
|
TotalAbsoluteValue: float32(dateBucket.X.Max - dateBucket.X.Min), |
|
|
|
}} |
|
|
|
} |
|
|
|
|
|
|
|
return dataDefinitionStatisticData |
|
|
|
} |
|
|
|
|
|
|
|