Parcourir la source

Update 调整测试协议

YueYunyun il y a 2 ans
Parent
commit
eb94fff0cf

+ 9 - 8
SERVER/Meter_Service/service/downStreamService/proto/test/test.go

@@ -5,6 +5,7 @@ import (
 	"MeterService/dataStruct"
 	"MeterService/dataStruct"
 	"MeterService/service/rtuService"
 	"MeterService/service/rtuService"
 	"errors"
 	"errors"
+	"math"
 	"reflect"
 	"reflect"
 	"runtime"
 	"runtime"
 )
 )
@@ -34,13 +35,13 @@ func CollectTest(w rtuService.RtuNetPgr, ref *dataStruct.MeterRef) (*dataStruct.
 func test001(adu []byte, s *dataStruct.CollectData) {
 func test001(adu []byte, s *dataStruct.CollectData) {
 	var (
 	var (
 		index = 0
 		index = 0
-		m     int16
 	)
 	)
-	m = int16(uint16(adu[index])<<8 | uint16(adu[index+1]))
-	s.Ua = float32(m)
-	index += 16
-	s.Ia = float32(m)
-	logger.Debug("TEST 采集成功  DATA:%v %v", s.Ua, s.Ia)
-}
+	m := uint32(adu[index])<<24 | uint32(adu[index+1])<<16 | uint32(adu[index+2])<<8 | uint32(adu[index+3])
 
 
-//
+	ua := math.Float32frombits(m)
+	logger.Debug("TEST 01采集成功  UA:%v %v", ua, m)
+	index += 32
+	n := uint32(adu[index])<<24 | uint32(adu[index+1])<<16 | uint32(adu[index+2])<<8 | uint32(adu[index+3])
+	ia := math.Float32frombits(n)
+	logger.Debug("TEST 01采集成功  IA:%v %v", ia, n)
+}