diff --git a/adaptors/振动to江苏省农村公路桥梁监测.go b/adaptors/振动to江苏省农村公路桥梁监测.go index 25f9fad..a3e14e8 100644 --- a/adaptors/振动to江苏省农村公路桥梁监测.go +++ b/adaptors/振动to江苏省农村公路桥梁监测.go @@ -42,11 +42,13 @@ func (the Adaptor_ZD_JSNCGLQL) ZDtoJSNCGLQL(zd models.ZDnew) (result []NeedPush) sourceId := fmt.Sprintf("%d_%d", zd.SensorId, zd.Channel) sensorCode := the.getSensorCode(sourceId) if sensorCode == "" { - log.Printf("振动 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 测点id,请检查配置文件", zd.Module) + log.Printf("振动 设备[%s] 无匹配的 江苏农村公路桥梁监测系统 sourceId=[%s],请检查配置文件", zd.Module, sourceId) return } topic := fmt.Sprintf("data/%s/%s", the.BridgeCode, sensorCode) + //江苏东交 固定 128HZ 16个采样点 作为 1秒16HZ + zd.Frequency = float32(len(zd.AccValues) * 1.0) //数据秒数 seconds := len(zd.AccValues) / int(zd.Frequency) diff --git a/consumers/consumerJSNCGLQL.go b/consumers/consumerJSNCGLQL.go index e14b653..4058b4e 100644 --- a/consumers/consumerJSNCGLQL.go +++ b/consumers/consumerJSNCGLQL.go @@ -38,7 +38,7 @@ func (the *consumerJSNCGLQL) Initial(cfg string) error { return err } func (the *consumerJSNCGLQL) InputInitial() error { - the.ch = make(chan []adaptors.NeedPush, 200) + the.ch = make(chan []adaptors.NeedPush, 500) //数据入口 the.InMqtt = dbOperate.MqttInitial( the.Info.IoConfig.In.Mqtt.Host, @@ -78,11 +78,13 @@ func (the *consumerJSNCGLQL) Work() { if push.Topic != "" { outTopic = push.Topic } + the.outMqtt.Publish(outTopic, push.Payload) + } } - time.Sleep(100 * time.Millisecond) + time.Sleep(5 * time.Millisecond) } }() } diff --git a/testUnit/江苏智感测试_test.go b/testUnit/江苏智感测试_test.go index ce3cd3c..38fe81a 100644 --- a/testUnit/江苏智感测试_test.go +++ b/testUnit/江苏智感测试_test.go @@ -64,7 +64,51 @@ func Test_江苏智感_加速度(t *testing.T) { bytes := adp.Transform(matchTopic, Msg) log.Println(bytes) } +func Test_江苏东交_加速度(t *testing.T) { + Msg := ` +{ + "Ticks": 1744259211391, + "Sensorid": 64085, + "Module": "1", + "Channel": 1, + "Frequency": 128, + "ThemeValue": [ + 190.05810893173759 + ], + "RawValues": [], + "AccValues": [ + -178.44, + -180.421, + -188.563, + -172.968, + -187.81, + -179.353, + -178.915, + -188.968, + -174.02, + -186.831, + -182.622, + -176.204, + -190.058, + -173.708, + -183.312, + -183.576 + ], + "ThemeItems": null +} +` + adp := adaptors.Adaptor_ZD_JSNCGLQL{ + IdMap: map[string]string{ + "64085_1": "LHTDQ-JSD-C08-001-01", + "m1c2": "LHTDQ-JSD-L03-001-01", + }, + BridgeCode: "G2320281L0012", + } + matchTopic := "upload/ZD" + bytes := adp.Transform(matchTopic, Msg) + log.Println(bytes) +} func Test_江苏智感_光电挠度(t *testing.T) { Msg := `