|
@@ -52,16 +52,14 @@ func PrepareTimeWindowProducerQueue() {
|
|
|
entity.Subscriber0Time = time.Now()
|
|
|
entity.Subscriber0TimeMutex.Unlock()
|
|
|
subscriber0Mutex.Lock()
|
|
|
- {
|
|
|
- faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
- lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
- var faultLabel string
|
|
|
- for _, f := range masterConfig.RuleOfNodefaultInfo {
|
|
|
- faultLabel = f(data)
|
|
|
- if faultLabel != "" {
|
|
|
- saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
- break
|
|
|
- }
|
|
|
+ faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
+ lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
+ var faultLabel string
|
|
|
+ for _, f := range masterConfig.RuleOfNodefaultInfo {
|
|
|
+ faultLabel = f(data)
|
|
|
+ if faultLabel != "" {
|
|
|
+ saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
subscriber0Mutex.Unlock()
|
|
@@ -83,24 +81,22 @@ func PrepareTimeWindowProducerQueue() {
|
|
|
return
|
|
|
}
|
|
|
subscriber1Mutex.Lock()
|
|
|
+ faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
+ lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
+ // 更新共享变量
|
|
|
+ m.RLock()
|
|
|
{
|
|
|
- faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
- lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
- // 更新共享变量
|
|
|
- m.RLock()
|
|
|
- {
|
|
|
- velocityX = data.VelocityX
|
|
|
- velocityY = data.VelocityY
|
|
|
- yaw = data.Yaw
|
|
|
- }
|
|
|
- m.RUnlock()
|
|
|
- var faultLabel string
|
|
|
- for _, f := range masterConfig.RuleOfCicvLocation {
|
|
|
- faultLabel = f(data)
|
|
|
- if faultLabel != "" {
|
|
|
- saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
- break
|
|
|
- }
|
|
|
+ velocityX = data.VelocityX
|
|
|
+ velocityY = data.VelocityY
|
|
|
+ yaw = data.Yaw
|
|
|
+ }
|
|
|
+ m.RUnlock()
|
|
|
+ var faultLabel string
|
|
|
+ for _, f := range masterConfig.RuleOfCicvLocation {
|
|
|
+ faultLabel = f(data)
|
|
|
+ if faultLabel != "" {
|
|
|
+ saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
subscriber1Mutex.Unlock()
|
|
@@ -123,7 +119,8 @@ func PrepareTimeWindowProducerQueue() {
|
|
|
entity.Subscriber2TimeMutex.Lock()
|
|
|
// 判断是否是连续故障码
|
|
|
gap := time.Since(entity.Subscriber2Time).Seconds()
|
|
|
- if gap < 10 {
|
|
|
+ if gap < 1 {
|
|
|
+ entity.Subscriber2Time = time.Now()
|
|
|
entity.Subscriber2TimeMutex.Unlock()
|
|
|
return
|
|
|
} else {
|
|
@@ -131,17 +128,15 @@ func PrepareTimeWindowProducerQueue() {
|
|
|
entity.Subscriber2Time = time.Now()
|
|
|
entity.Subscriber2TimeMutex.Unlock()
|
|
|
subscriber2Mutex.Lock()
|
|
|
- {
|
|
|
- faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
- lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
- var faultLabel string
|
|
|
- c_log.GlobalLogger.Infof("TTC数据为:【velocityX】=%v,【velocityY】=%v", velocityX, velocityY)
|
|
|
- for _, f := range masterConfig.RuleOfTpperception {
|
|
|
- faultLabel = f(data, velocityX, velocityY, yaw)
|
|
|
- if faultLabel != "" {
|
|
|
- saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
- break
|
|
|
- }
|
|
|
+ faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
+ lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
+ var faultLabel string
|
|
|
+ c_log.GlobalLogger.Infof("TTC数据为:【velocityX】=%v,【velocityY】=%v", velocityX, velocityY)
|
|
|
+ for _, f := range masterConfig.RuleOfTpperception {
|
|
|
+ faultLabel = f(data, velocityX, velocityY, yaw)
|
|
|
+ if faultLabel != "" {
|
|
|
+ saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
subscriber2Mutex.Unlock()
|
|
@@ -206,16 +201,14 @@ func PrepareTimeWindowProducerQueue() {
|
|
|
return
|
|
|
}
|
|
|
subscriber4Mutex.Lock()
|
|
|
- {
|
|
|
- faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
- lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
- var faultLabel string
|
|
|
- for _, f := range masterConfig.RuleOfDataRead {
|
|
|
- faultLabel = f(data)
|
|
|
- if faultLabel != "" {
|
|
|
- saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
- break
|
|
|
- }
|
|
|
+ faultHappenTime := util.GetNowTimeCustom() // 获取当前故障发生时间
|
|
|
+ lastTimeWindow := entity.GetLastTimeWindow() // 获取最后一个时间窗口
|
|
|
+ var faultLabel string
|
|
|
+ for _, f := range masterConfig.RuleOfDataRead {
|
|
|
+ faultLabel = f(data)
|
|
|
+ if faultLabel != "" {
|
|
|
+ saveTimeWindow(faultLabel, faultHappenTime, lastTimeWindow)
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
subscriber4Mutex.Unlock()
|